settysantu Posted June 20, 2007 Share Posted June 20, 2007 i have done a registration form but showing some error my problem is its not displaying form in browser <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("registration", $con); $sql="INSERT INTO person (username, password, e-mail, gender, country, pincode) VALUES ( $_POST[username], $_POST[password], $_POST[e-mail], $_POST[gender], $_POST[country], $_POST[pincode] )"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); ?> <div align="center"> <b>REGISTRATION FORM</b> <form name="registration form" method="post" action=""> User Name:<input name="username" type="text" /><br /><br /> Passowrd:<input name="password" type="password" /><br /><br /> E-mail Id:<input name="e-mail" type="text" /><br /><br /> Gender:<input name="gender" type="text" /><br /><br /> <br /> Country:<input name="country" type="text" /><br/><br /> Pincode:<input name="pincode" type="text" maxlength="8" /> <br><br /> <input type="submit" name="submit" value="submit"> <input type="reset" value="reset"> </form> </div> advance thxs santosh setty Quote Link to comment https://forums.phpfreaks.com/topic/56386-registration-form-help/ Share on other sites More sharing options...
virtuexru Posted June 20, 2007 Share Posted June 20, 2007 if (mysql_query($sql)) { echo "1 record added"; } else { die("Error: ". mysql_error()); } Quote Link to comment https://forums.phpfreaks.com/topic/56386-registration-form-help/#findComment-278496 Share on other sites More sharing options...
cluce Posted June 20, 2007 Share Posted June 20, 2007 I would do two pages one registration.html and submit.php. and when they hit submit on the registration it executes the php code. here is the registration page code I modified <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action="submit.php"> <p>User Name: <input name="username" type="text" /> <br /> <br /> Passowrd:<input name="password" type="password" /> <br /> <br /> E-mail Id:<input name="e-mail" type="text" /> <br /> <br /> Gender:<input name="gender" type="text" /> <br /> <br /> <br /> Country:<input name="country" type="text" /> <br/> <br /> Pincode:<input name="pincode" type="text" maxlength="8" /> </p> <p> <input type="submit" name="Submit" value="Submit" /> </p> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/56386-registration-form-help/#findComment-278502 Share on other sites More sharing options...
evry1falls Posted June 20, 2007 Share Posted June 20, 2007 i also suggest makin 2 files " register.html " and " register.php " and assign the " register.php " file to the form , so wen u click "submit" it excudes th "register.php" .............. also : - make sure you are connected to mysql . " if ($con) { echo "mysql is connected<b />"; } else { die('couldn't connect to mysql coz:' . mysql_error()); } . - and do the same to your other connections such as the Database and mysql_query . if everything went ok and all are cnnected right , then try the 2 files thing ! Quote Link to comment https://forums.phpfreaks.com/topic/56386-registration-form-help/#findComment-278516 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.