php - Form data not storing in database -
ok registration form data not getting stored in database. whereas if $name="bill";
storing $name='name';
not working. secondly when i click
on register button
shows php code of file connect.php.
registration code
<body> <div id="registration"> <h2><b><i>electronic montessori learning</i><b></h2> <form id="registeruserform" action="connect.php" method="post"> <fieldset> <p> <label for="name">name</label> <input id="name" name="name" type="text" class="text" value="" /> </p> <p> <label for="password">password</label> <input id="password" name="password" class="text" type="password" /> </p> <p> <button id="registernew" type="submit">register</button> </p> </fieldset> </form> </div> <body>
and connect.php code
<?php $db=mysql_connect("localhost", "root", "") or die(mysql_error()); echo "connected mysql<br />"; mysql_select_db("users") or die(mysql_error()); echo "connected database"; if(isset($_post['submit'])){ // storing form values php variables $name = $_post['name']; // since method=”post” in form $password = $_post['password']; mysql_query("insert user_eml(name, password) values('$name', '$password' ) ") or die(mysql_error()); echo "data inserted!"; echo 'thank submitting details!'; } ?>
you forgot name
attribute here
<button id="registernew" type="submit" name="submit">register</button>
and because of condition never true
if(isset($_post['submit']))
Comments
Post a Comment