PHP insert data into SQL Database Table produces blank row Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to process POST data in Node.js?Undefined Index Error & No Output From POST/GETBest way to get identity of inserted row?How can I prevent SQL injection in PHP?Add a column with a default value to an existing table in SQL ServerHow to check if a column exists in a SQL Server table?How to concatenate text from multiple rows into a single text string in SQL server?Inserting multiple rows in a single SQL query?Insert results of a stored procedure into a temporary tableFinding duplicate values in a SQL tableFind all tables containing column with specified name - MS SQL ServerGet size of all tables in database
What came first? Venom as the movie or as the song?
Why does BitLocker not use RSA?
Like totally amazing interchangeable sister outfit accessory swapping or whatever
How do I deal with an erroneously large refund?
Can gravitational waves pass through a black hole?
Is it OK if I do not take the receipt in Germany?
Suing a Police Officer Instead of the Police Department
Im stuck and having trouble with ¬P ∨ Q Prove: P → Q
What kind of equipment or other technology is necessary to photograph sprites (atmospheric phenomenon)
Coin Game with infinite paradox
How can I wire a 9-position switch so that each position turns on one more LED than the one before?
Proving inequality for positive definite matrix
Raising a bilingual kid. When should we introduce the majority language?
Knights and Knaves question
/bin/ls sorts differently than just ls
What could prevent concentrated local exploration?
Can I ask an author to send me his ebook?
2 sample t test for sample sizes - 30,000 and 150,000
What helicopter has the most rotor blades?
What *exactly* is electrical current, voltage, and resistance?
Will the Antimagic Field spell cause elementals not summoned by magic to dissipate?
Etymology of 見舞い
Who's this lady in the war room?
Assertions In A Mock Callout Test
PHP insert data into SQL Database Table produces blank row
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to process POST data in Node.js?Undefined Index Error & No Output From POST/GETBest way to get identity of inserted row?How can I prevent SQL injection in PHP?Add a column with a default value to an existing table in SQL ServerHow to check if a column exists in a SQL Server table?How to concatenate text from multiple rows into a single text string in SQL server?Inserting multiple rows in a single SQL query?Insert results of a stored procedure into a temporary tableFinding duplicate values in a SQL tableFind all tables containing column with specified name - MS SQL ServerGet size of all tables in database
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm trying to insert data from the form created into the SQL Server Database Table that is connected through ODBC. After I submit the data it shows up as a blank row with only the ID that has a value. I am very new to PHP and got parts of code from tutorials. This is just a test project. Here's the code:
<html>
<header>
<title>
</title>
</header>
<body>
<form action="INSERTCODE.php" method="POST">
<input type= "number" step="any" name="sepal_lengp" placeholder="Sepal Length">
<input type= "number" step="any" name="sepal_widthp" placeholder="Sepal Width">
<input type= "number" step="any" name="petal_lengp" placeholder="Petal Length">
<input type= "number" step="any" name="petal_widthp" placeholder="Petal Width">
<input type= "text" name="flower_type" placeholder="Flower Name">
<button type="submit" name="submit" >INPUT VALUES</button>
</form>
<?php
//display all results from table
include("C:UsersDshopDesktopphp-7.3.3Server1connection.php");
$i=1;
$sql = "SELECT * FROM dbo.textcsv";
$result = odbc_exec( $connection, $sql );
while($all =odbc_result_all($result,$i) )
echo $all;
?>
</body>
</html>
This part includes the form. The filename is index1.php.
<?php
include("C:UsersDshopDesktopphp-7.3.3Server1connection.php");
$sepal_lengp = $_POST['sepal_lengp']??'';
$sepal_widthp = $_POST['sepal_widthp']??'';
$petal_lengp = $_POST['petal_lengp']??'';
$petal_widthp = $_POST['petal_widthp']??'';
$flower_typep = $_POST['flower_typep']??'';
$dbinsert = "INSERT INTO dbo.textcsv (sepal_leng, sepal_width, petal_leng, petal_width, flower_type) VALUES ('$sepal_lengp', '$sepal_widthp', '$petal_lengp', '$petal_widthp', '$flower_typep');";
odbc_exec( $connection, $dbinsert );
HEADER("Location: ../index1.php?=success");
This part inserts data into the database table, using $_POST to obtain the data from index1.php. This file is called INSERTCODE.php. $connection and connection.php is the file that includes the connection to ODBC.
For this test project I used the Iris dataset. I believe that I had to use ODBC and SQL Server instead of mysql. Sql server is the 2014 version, PHP is 7.33, using node.js to run the server. Help is greatly appreciated!
EDIT I found out that the $_POST isn't getting any values from the form. Any ideas?
EDIT 2 I've tried using $_REQUEST, checking var_dump, and did all that stuff, but I still got nothing. After going to https://www.w3schools.com/php7/php7_forms.asp for an example form, I found out that the example did not work either. Now i'm not sure if the problem is from the code, or from something like the php configuration. Need help, please help.
php sql sql-server odbc
|
show 1 more comment
I'm trying to insert data from the form created into the SQL Server Database Table that is connected through ODBC. After I submit the data it shows up as a blank row with only the ID that has a value. I am very new to PHP and got parts of code from tutorials. This is just a test project. Here's the code:
<html>
<header>
<title>
</title>
</header>
<body>
<form action="INSERTCODE.php" method="POST">
<input type= "number" step="any" name="sepal_lengp" placeholder="Sepal Length">
<input type= "number" step="any" name="sepal_widthp" placeholder="Sepal Width">
<input type= "number" step="any" name="petal_lengp" placeholder="Petal Length">
<input type= "number" step="any" name="petal_widthp" placeholder="Petal Width">
<input type= "text" name="flower_type" placeholder="Flower Name">
<button type="submit" name="submit" >INPUT VALUES</button>
</form>
<?php
//display all results from table
include("C:UsersDshopDesktopphp-7.3.3Server1connection.php");
$i=1;
$sql = "SELECT * FROM dbo.textcsv";
$result = odbc_exec( $connection, $sql );
while($all =odbc_result_all($result,$i) )
echo $all;
?>
</body>
</html>
This part includes the form. The filename is index1.php.
<?php
include("C:UsersDshopDesktopphp-7.3.3Server1connection.php");
$sepal_lengp = $_POST['sepal_lengp']??'';
$sepal_widthp = $_POST['sepal_widthp']??'';
$petal_lengp = $_POST['petal_lengp']??'';
$petal_widthp = $_POST['petal_widthp']??'';
$flower_typep = $_POST['flower_typep']??'';
$dbinsert = "INSERT INTO dbo.textcsv (sepal_leng, sepal_width, petal_leng, petal_width, flower_type) VALUES ('$sepal_lengp', '$sepal_widthp', '$petal_lengp', '$petal_widthp', '$flower_typep');";
odbc_exec( $connection, $dbinsert );
HEADER("Location: ../index1.php?=success");
This part inserts data into the database table, using $_POST to obtain the data from index1.php. This file is called INSERTCODE.php. $connection and connection.php is the file that includes the connection to ODBC.
For this test project I used the Iris dataset. I believe that I had to use ODBC and SQL Server instead of mysql. Sql server is the 2014 version, PHP is 7.33, using node.js to run the server. Help is greatly appreciated!
EDIT I found out that the $_POST isn't getting any values from the form. Any ideas?
EDIT 2 I've tried using $_REQUEST, checking var_dump, and did all that stuff, but I still got nothing. After going to https://www.w3schools.com/php7/php7_forms.asp for an example form, I found out that the example did not work either. Now i'm not sure if the problem is from the code, or from something like the php configuration. Need help, please help.
php sql sql-server odbc
1
Little Bobby says your script is at risk for SQL Injection Attacks.. Even escaping the string is not safe!
– Jay Blanchard
Mar 22 at 14:38
not sure if the type=number and step=any is really working on any webbrowser..and how it handle float numbers.... what does the $sepal_lengp contains before it gets into database? var_dump($sepal_lengp)
– Christian Felix
Mar 22 at 14:46
@ChristianFelix imgur.com/a/wd9QPoI when i remove step from the code this happens. $sepal_lengp should just be the user input from the form. Edit: Not sure about the var_dump part, do you want me to echo what it returns?echo var_dump($sepal_lengp); gives string(0) "". I'm kinda new.
– Alex
Mar 22 at 14:53
then your problem is related to your values posted via formular. you posting the data to INSERTCODE.php.... are you really getting in this file? when yes, var_dump($_POST) data and check whether the values are really available
– Christian Felix
Mar 22 at 15:11
@ChristianFelix I just checked and found out that INSERTCODE.php didn't get any value from the form, any ideas?
– Alex
Mar 22 at 22:33
|
show 1 more comment
I'm trying to insert data from the form created into the SQL Server Database Table that is connected through ODBC. After I submit the data it shows up as a blank row with only the ID that has a value. I am very new to PHP and got parts of code from tutorials. This is just a test project. Here's the code:
<html>
<header>
<title>
</title>
</header>
<body>
<form action="INSERTCODE.php" method="POST">
<input type= "number" step="any" name="sepal_lengp" placeholder="Sepal Length">
<input type= "number" step="any" name="sepal_widthp" placeholder="Sepal Width">
<input type= "number" step="any" name="petal_lengp" placeholder="Petal Length">
<input type= "number" step="any" name="petal_widthp" placeholder="Petal Width">
<input type= "text" name="flower_type" placeholder="Flower Name">
<button type="submit" name="submit" >INPUT VALUES</button>
</form>
<?php
//display all results from table
include("C:UsersDshopDesktopphp-7.3.3Server1connection.php");
$i=1;
$sql = "SELECT * FROM dbo.textcsv";
$result = odbc_exec( $connection, $sql );
while($all =odbc_result_all($result,$i) )
echo $all;
?>
</body>
</html>
This part includes the form. The filename is index1.php.
<?php
include("C:UsersDshopDesktopphp-7.3.3Server1connection.php");
$sepal_lengp = $_POST['sepal_lengp']??'';
$sepal_widthp = $_POST['sepal_widthp']??'';
$petal_lengp = $_POST['petal_lengp']??'';
$petal_widthp = $_POST['petal_widthp']??'';
$flower_typep = $_POST['flower_typep']??'';
$dbinsert = "INSERT INTO dbo.textcsv (sepal_leng, sepal_width, petal_leng, petal_width, flower_type) VALUES ('$sepal_lengp', '$sepal_widthp', '$petal_lengp', '$petal_widthp', '$flower_typep');";
odbc_exec( $connection, $dbinsert );
HEADER("Location: ../index1.php?=success");
This part inserts data into the database table, using $_POST to obtain the data from index1.php. This file is called INSERTCODE.php. $connection and connection.php is the file that includes the connection to ODBC.
For this test project I used the Iris dataset. I believe that I had to use ODBC and SQL Server instead of mysql. Sql server is the 2014 version, PHP is 7.33, using node.js to run the server. Help is greatly appreciated!
EDIT I found out that the $_POST isn't getting any values from the form. Any ideas?
EDIT 2 I've tried using $_REQUEST, checking var_dump, and did all that stuff, but I still got nothing. After going to https://www.w3schools.com/php7/php7_forms.asp for an example form, I found out that the example did not work either. Now i'm not sure if the problem is from the code, or from something like the php configuration. Need help, please help.
php sql sql-server odbc
I'm trying to insert data from the form created into the SQL Server Database Table that is connected through ODBC. After I submit the data it shows up as a blank row with only the ID that has a value. I am very new to PHP and got parts of code from tutorials. This is just a test project. Here's the code:
<html>
<header>
<title>
</title>
</header>
<body>
<form action="INSERTCODE.php" method="POST">
<input type= "number" step="any" name="sepal_lengp" placeholder="Sepal Length">
<input type= "number" step="any" name="sepal_widthp" placeholder="Sepal Width">
<input type= "number" step="any" name="petal_lengp" placeholder="Petal Length">
<input type= "number" step="any" name="petal_widthp" placeholder="Petal Width">
<input type= "text" name="flower_type" placeholder="Flower Name">
<button type="submit" name="submit" >INPUT VALUES</button>
</form>
<?php
//display all results from table
include("C:UsersDshopDesktopphp-7.3.3Server1connection.php");
$i=1;
$sql = "SELECT * FROM dbo.textcsv";
$result = odbc_exec( $connection, $sql );
while($all =odbc_result_all($result,$i) )
echo $all;
?>
</body>
</html>
This part includes the form. The filename is index1.php.
<?php
include("C:UsersDshopDesktopphp-7.3.3Server1connection.php");
$sepal_lengp = $_POST['sepal_lengp']??'';
$sepal_widthp = $_POST['sepal_widthp']??'';
$petal_lengp = $_POST['petal_lengp']??'';
$petal_widthp = $_POST['petal_widthp']??'';
$flower_typep = $_POST['flower_typep']??'';
$dbinsert = "INSERT INTO dbo.textcsv (sepal_leng, sepal_width, petal_leng, petal_width, flower_type) VALUES ('$sepal_lengp', '$sepal_widthp', '$petal_lengp', '$petal_widthp', '$flower_typep');";
odbc_exec( $connection, $dbinsert );
HEADER("Location: ../index1.php?=success");
This part inserts data into the database table, using $_POST to obtain the data from index1.php. This file is called INSERTCODE.php. $connection and connection.php is the file that includes the connection to ODBC.
For this test project I used the Iris dataset. I believe that I had to use ODBC and SQL Server instead of mysql. Sql server is the 2014 version, PHP is 7.33, using node.js to run the server. Help is greatly appreciated!
EDIT I found out that the $_POST isn't getting any values from the form. Any ideas?
EDIT 2 I've tried using $_REQUEST, checking var_dump, and did all that stuff, but I still got nothing. After going to https://www.w3schools.com/php7/php7_forms.asp for an example form, I found out that the example did not work either. Now i'm not sure if the problem is from the code, or from something like the php configuration. Need help, please help.
php sql sql-server odbc
php sql sql-server odbc
edited Mar 25 at 13:43
Alex
asked Mar 22 at 14:32
AlexAlex
85
85
1
Little Bobby says your script is at risk for SQL Injection Attacks.. Even escaping the string is not safe!
– Jay Blanchard
Mar 22 at 14:38
not sure if the type=number and step=any is really working on any webbrowser..and how it handle float numbers.... what does the $sepal_lengp contains before it gets into database? var_dump($sepal_lengp)
– Christian Felix
Mar 22 at 14:46
@ChristianFelix imgur.com/a/wd9QPoI when i remove step from the code this happens. $sepal_lengp should just be the user input from the form. Edit: Not sure about the var_dump part, do you want me to echo what it returns?echo var_dump($sepal_lengp); gives string(0) "". I'm kinda new.
– Alex
Mar 22 at 14:53
then your problem is related to your values posted via formular. you posting the data to INSERTCODE.php.... are you really getting in this file? when yes, var_dump($_POST) data and check whether the values are really available
– Christian Felix
Mar 22 at 15:11
@ChristianFelix I just checked and found out that INSERTCODE.php didn't get any value from the form, any ideas?
– Alex
Mar 22 at 22:33
|
show 1 more comment
1
Little Bobby says your script is at risk for SQL Injection Attacks.. Even escaping the string is not safe!
– Jay Blanchard
Mar 22 at 14:38
not sure if the type=number and step=any is really working on any webbrowser..and how it handle float numbers.... what does the $sepal_lengp contains before it gets into database? var_dump($sepal_lengp)
– Christian Felix
Mar 22 at 14:46
@ChristianFelix imgur.com/a/wd9QPoI when i remove step from the code this happens. $sepal_lengp should just be the user input from the form. Edit: Not sure about the var_dump part, do you want me to echo what it returns?echo var_dump($sepal_lengp); gives string(0) "". I'm kinda new.
– Alex
Mar 22 at 14:53
then your problem is related to your values posted via formular. you posting the data to INSERTCODE.php.... are you really getting in this file? when yes, var_dump($_POST) data and check whether the values are really available
– Christian Felix
Mar 22 at 15:11
@ChristianFelix I just checked and found out that INSERTCODE.php didn't get any value from the form, any ideas?
– Alex
Mar 22 at 22:33
1
1
Little Bobby says your script is at risk for SQL Injection Attacks.. Even escaping the string is not safe!
– Jay Blanchard
Mar 22 at 14:38
Little Bobby says your script is at risk for SQL Injection Attacks.. Even escaping the string is not safe!
– Jay Blanchard
Mar 22 at 14:38
not sure if the type=number and step=any is really working on any webbrowser..and how it handle float numbers.... what does the $sepal_lengp contains before it gets into database? var_dump($sepal_lengp)
– Christian Felix
Mar 22 at 14:46
not sure if the type=number and step=any is really working on any webbrowser..and how it handle float numbers.... what does the $sepal_lengp contains before it gets into database? var_dump($sepal_lengp)
– Christian Felix
Mar 22 at 14:46
@ChristianFelix imgur.com/a/wd9QPoI when i remove step from the code this happens. $sepal_lengp should just be the user input from the form. Edit: Not sure about the var_dump part, do you want me to echo what it returns?echo var_dump($sepal_lengp); gives string(0) "". I'm kinda new.
– Alex
Mar 22 at 14:53
@ChristianFelix imgur.com/a/wd9QPoI when i remove step from the code this happens. $sepal_lengp should just be the user input from the form. Edit: Not sure about the var_dump part, do you want me to echo what it returns?echo var_dump($sepal_lengp); gives string(0) "". I'm kinda new.
– Alex
Mar 22 at 14:53
then your problem is related to your values posted via formular. you posting the data to INSERTCODE.php.... are you really getting in this file? when yes, var_dump($_POST) data and check whether the values are really available
– Christian Felix
Mar 22 at 15:11
then your problem is related to your values posted via formular. you posting the data to INSERTCODE.php.... are you really getting in this file? when yes, var_dump($_POST) data and check whether the values are really available
– Christian Felix
Mar 22 at 15:11
@ChristianFelix I just checked and found out that INSERTCODE.php didn't get any value from the form, any ideas?
– Alex
Mar 22 at 22:33
@ChristianFelix I just checked and found out that INSERTCODE.php didn't get any value from the form, any ideas?
– Alex
Mar 22 at 22:33
|
show 1 more comment
2 Answers
2
active
oldest
votes
you're treating your variables as strings, by th look of your database you want them as floats. Try using floatval( ) (http://php.net/manual/en/function.floatval.php) on your variables to make sure they are in the write format, this will also go some way to sanitising them until you update this to prepare statements so you can safely bind the values and specify the type
I used floatval() over the $_POST(ex. $sepal_lengp = floatval($_POST['sepal_lengp']??'');) when I run the form now it looks like this imgur.com/a/a0g23c0 Im going to check if the form gets any data at all now.
– Alex
Mar 22 at 22:19
add a comment |
After rephrasing my issue to "node.js not taking post data" I found the issue. Node.js needs extra steps to process POST data. So, because of this, my input was ignored by node.js and the INSERTDATA.php ran without any data to insert anything. Turns out the solution of the problem was to use something like the body-parser or the other solution from another question.
The solution I took was to uninstall node.js and use XAMPP instead. It was much easier to use.
Also could someone flag my question for duplicate?
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55301897%2fphp-insert-data-into-sql-database-table-produces-blank-row%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
you're treating your variables as strings, by th look of your database you want them as floats. Try using floatval( ) (http://php.net/manual/en/function.floatval.php) on your variables to make sure they are in the write format, this will also go some way to sanitising them until you update this to prepare statements so you can safely bind the values and specify the type
I used floatval() over the $_POST(ex. $sepal_lengp = floatval($_POST['sepal_lengp']??'');) when I run the form now it looks like this imgur.com/a/a0g23c0 Im going to check if the form gets any data at all now.
– Alex
Mar 22 at 22:19
add a comment |
you're treating your variables as strings, by th look of your database you want them as floats. Try using floatval( ) (http://php.net/manual/en/function.floatval.php) on your variables to make sure they are in the write format, this will also go some way to sanitising them until you update this to prepare statements so you can safely bind the values and specify the type
I used floatval() over the $_POST(ex. $sepal_lengp = floatval($_POST['sepal_lengp']??'');) when I run the form now it looks like this imgur.com/a/a0g23c0 Im going to check if the form gets any data at all now.
– Alex
Mar 22 at 22:19
add a comment |
you're treating your variables as strings, by th look of your database you want them as floats. Try using floatval( ) (http://php.net/manual/en/function.floatval.php) on your variables to make sure they are in the write format, this will also go some way to sanitising them until you update this to prepare statements so you can safely bind the values and specify the type
you're treating your variables as strings, by th look of your database you want them as floats. Try using floatval( ) (http://php.net/manual/en/function.floatval.php) on your variables to make sure they are in the write format, this will also go some way to sanitising them until you update this to prepare statements so you can safely bind the values and specify the type
answered Mar 22 at 16:27
jameson2012jameson2012
491413
491413
I used floatval() over the $_POST(ex. $sepal_lengp = floatval($_POST['sepal_lengp']??'');) when I run the form now it looks like this imgur.com/a/a0g23c0 Im going to check if the form gets any data at all now.
– Alex
Mar 22 at 22:19
add a comment |
I used floatval() over the $_POST(ex. $sepal_lengp = floatval($_POST['sepal_lengp']??'');) when I run the form now it looks like this imgur.com/a/a0g23c0 Im going to check if the form gets any data at all now.
– Alex
Mar 22 at 22:19
I used floatval() over the $_POST(ex. $sepal_lengp = floatval($_POST['sepal_lengp']??'');) when I run the form now it looks like this imgur.com/a/a0g23c0 Im going to check if the form gets any data at all now.
– Alex
Mar 22 at 22:19
I used floatval() over the $_POST(ex. $sepal_lengp = floatval($_POST['sepal_lengp']??'');) when I run the form now it looks like this imgur.com/a/a0g23c0 Im going to check if the form gets any data at all now.
– Alex
Mar 22 at 22:19
add a comment |
After rephrasing my issue to "node.js not taking post data" I found the issue. Node.js needs extra steps to process POST data. So, because of this, my input was ignored by node.js and the INSERTDATA.php ran without any data to insert anything. Turns out the solution of the problem was to use something like the body-parser or the other solution from another question.
The solution I took was to uninstall node.js and use XAMPP instead. It was much easier to use.
Also could someone flag my question for duplicate?
add a comment |
After rephrasing my issue to "node.js not taking post data" I found the issue. Node.js needs extra steps to process POST data. So, because of this, my input was ignored by node.js and the INSERTDATA.php ran without any data to insert anything. Turns out the solution of the problem was to use something like the body-parser or the other solution from another question.
The solution I took was to uninstall node.js and use XAMPP instead. It was much easier to use.
Also could someone flag my question for duplicate?
add a comment |
After rephrasing my issue to "node.js not taking post data" I found the issue. Node.js needs extra steps to process POST data. So, because of this, my input was ignored by node.js and the INSERTDATA.php ran without any data to insert anything. Turns out the solution of the problem was to use something like the body-parser or the other solution from another question.
The solution I took was to uninstall node.js and use XAMPP instead. It was much easier to use.
Also could someone flag my question for duplicate?
After rephrasing my issue to "node.js not taking post data" I found the issue. Node.js needs extra steps to process POST data. So, because of this, my input was ignored by node.js and the INSERTDATA.php ran without any data to insert anything. Turns out the solution of the problem was to use something like the body-parser or the other solution from another question.
The solution I took was to uninstall node.js and use XAMPP instead. It was much easier to use.
Also could someone flag my question for duplicate?
answered Mar 29 at 14:28
AlexAlex
85
85
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55301897%2fphp-insert-data-into-sql-database-table-produces-blank-row%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Little Bobby says your script is at risk for SQL Injection Attacks.. Even escaping the string is not safe!
– Jay Blanchard
Mar 22 at 14:38
not sure if the type=number and step=any is really working on any webbrowser..and how it handle float numbers.... what does the $sepal_lengp contains before it gets into database? var_dump($sepal_lengp)
– Christian Felix
Mar 22 at 14:46
@ChristianFelix imgur.com/a/wd9QPoI when i remove step from the code this happens. $sepal_lengp should just be the user input from the form. Edit: Not sure about the var_dump part, do you want me to echo what it returns?echo var_dump($sepal_lengp); gives string(0) "". I'm kinda new.
– Alex
Mar 22 at 14:53
then your problem is related to your values posted via formular. you posting the data to INSERTCODE.php.... are you really getting in this file? when yes, var_dump($_POST) data and check whether the values are really available
– Christian Felix
Mar 22 at 15:11
@ChristianFelix I just checked and found out that INSERTCODE.php didn't get any value from the form, any ideas?
– Alex
Mar 22 at 22:33