bobicles2 Posted April 21, 2010 Share Posted April 21, 2010 i have a HTML form to register users to my website, when i fill the form out however, the username and email are not send to the database...although the password is...below is the php code and ive enclosed the form as well as a screenshot of my database incase thats the problem, where am i going wrong! php is cracking my brains thanks rob <?php $con = mysql_connect("localhost","?????","??????"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("teamrend_rwowen", $con); $sql="INSERT INTO Members (Username, Password, Email) VALUES ('$_POST[username]','$_POST[Password]','$_POST[Email]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Thank You, You are now a registered user"; mysql_close($con) ?> <form name="form2" method="post" action="registerphp.php"> <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DBDBDB"> <tr> <td colspan="3"><p align="center"><strong>Please Register </strong></p> <p> </p></td> </tr> <tr> <td width="78">Username </td> <td width="6">:</td> <td width="294"><input type="text" name="Username" id="Username"/></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input type="text" name="Password" id="Password" /></td> </tr> <tr> <td>Email</td> <td>:</td> <td><input type="text" name="Email" id="Email" /></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit" /></td> </tr> </table></td> </form> Here is my database set up[, and below is a screenshot of my attemps to register. the ID auto increments as normal, the username and email stays blank but for some reason password goes in just fine Link to comment https://forums.phpfreaks.com/topic/199255-inserting-into-a-table/ Share on other sites More sharing options...
Pikachu2000 Posted April 21, 2010 Share Posted April 21, 2010 Have you echoed the query string to make sure it contains the values you'd expect it to contain? Link to comment https://forums.phpfreaks.com/topic/199255-inserting-into-a-table/#findComment-1045810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.