luckyimran111 Posted September 18, 2012 Share Posted September 18, 2012 (edited) I'm making this Registration form but After pressing Submit button I did not get data in mysql database so here is my all code any one will help meRegistration_form.php <!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=utf-8" /><title>Registration Form</title></head><body><body><table width="200" border="0" align="center"><form id="form1" name="form1" method="post" action="registration_script.php"><tr><td colspan="2"><h2 style="color:#FF0000">Registration Form</h2></td></tr><tr><td>UserName:</td><td><input type="text" name="txtUser" id="txtUser" /></td></tr><tr><td>Password:</td><td><input type="password" name="txtPassword" id="txtPassword" /></td></tr><tr><td colspan="2" align="center"><input type="submit" name="btnRegister" id="btnRegister" value="Register" /></td></tr></form></table></body></html></body> here is registraion_script.php <?php//=============Configuring Server and Database=======$host = 'localhost';$user = 'root';$password = '';//=============Data Base Information=================$database = 'test'; $conn = mysql_connect($host,$user,$password) or die('Server Information is not Correct'); //Establish Connection with Servermysql_select_db($database,$conn) or die('Database Information is not correct'); //===============End Server Configuration============ //=============Starting Registration Script========== $userName = $_POST['txtUser']; $password = $_POST['txtPassword']; //=============To Encrypt Password===================$password = md5($password);//============New Variable of Password is Now with an Encrypted Value======== if(isset($_POST['btnRegister'])) //===When I will Set the Button to 1 or Press Button to register{$query = "insert into test(username,password)values('$userName','$password')";$res = mysql_query($query);header('location:success_register.php');} ?> ***** any COMMENT WILL BE USEFUL FOR ME >>> SO PLEASE COMMENT ON IT ALSO Edited September 18, 2012 by luckyimran111 Link to comment Share on other sites More sharing options...
niche Posted September 18, 2012 Share Posted September 18, 2012 What do you want to know specifically? Link to comment Share on other sites More sharing options...
Ingolme Posted September 18, 2012 Share Posted September 18, 2012 First of all, you should be checking whether the query worked or not and find out why using mysql_error(). $query = "insert into test(username,password)values('$userName','$password')";$res = mysql_query($query);if(!$res) { echo mysql_error();} else { header('location:success_register.php');} On a side note, MD5 is considered insufficient protection for passwords today. Link to comment Share on other sites More sharing options...
luckyimran111 Posted September 18, 2012 Author Share Posted September 18, 2012 after inserting 'if not' with mysql_error (); there is Blank page dear but still not getting data into database ... :sorry: Link to comment Share on other sites More sharing options...
Ingolme Posted September 18, 2012 Share Posted September 18, 2012 It sounds like you might have error displaying off.Put this at the beginning of the page: ini_set('display_errors', 1);error_reporting(E_ALL); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now