xxreenaxx1 Posted February 16, 2011 Share Posted February 16, 2011 Hey guy <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Examination", $con); $sql="INSERT INTO Test (Tes_Name, Tes_Description) VALUES ('$_POST[Tes_Name]','$_POST[Tes_Description]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> This is my code and I can enter Tes_Name on to mysql but nothing is shown for Tes_Description. The form is <html> <body> <h3>Test</h3> <table border="0"> <form method="POST" action="try2.php"> <tr><td>Tes_Name</td><td>:</td><td><input type="text" name="Tes_Name" size="20"></td></tr> <tr><td>Tes_Description</td><td>:</td><td><input type="Tes_Description" name="password" size="20"></td></tr> <tr><td> </td><td> </td><td><input type="submit" value="Submit"></td></tr> </form> </table> </body> </html> Link to comment https://forums.phpfreaks.com/topic/227879-i-have-entered-two-values-but-only-one-is-being-added-to-the-mysql/ Share on other sites More sharing options...
Maq Posted February 16, 2011 Share Posted February 16, 2011 Because the name of your input field is "password" not "Tes_Description". Link to comment https://forums.phpfreaks.com/topic/227879-i-have-entered-two-values-but-only-one-is-being-added-to-the-mysql/#findComment-1175045 Share on other sites More sharing options...
ansharma Posted February 16, 2011 Share Posted February 16, 2011 you supplied wrong argument in input field choose proper type field type="text" <input type="Tes_Description" name="password" size="20"> Link to comment https://forums.phpfreaks.com/topic/227879-i-have-entered-two-values-but-only-one-is-being-added-to-the-mysql/#findComment-1175047 Share on other sites More sharing options...
xxreenaxx1 Posted February 16, 2011 Author Share Posted February 16, 2011 oops.. I though type was the name... Thank you Sorted Link to comment https://forums.phpfreaks.com/topic/227879-i-have-entered-two-values-but-only-one-is-being-added-to-the-mysql/#findComment-1175048 Share on other sites More sharing options...
Maq Posted February 16, 2011 Share Posted February 16, 2011 In addition to what ansharma said, your input field should look like: Link to comment https://forums.phpfreaks.com/topic/227879-i-have-entered-two-values-but-only-one-is-being-added-to-the-mysql/#findComment-1175049 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.