mysql - registration form values are not getting inserted into database in php -


registration form values not getting inserted database in php. showing error while using mysql_connect , when using mysqli_connect, values not getting inserted database.

form.html

<html> <body> <form action="signup.php" method="post"> username <input type="text" name="username"> password <input type="password" name="password"> <input type="submit" value="ok" name="submit"> </body> </html> 

signup.php

<?php $connection=mysqli_connect("localhost","root","","form") or die("not connected");  if(isset($_post['submit'])){  $username=mysql_real_escape_string($_post['username']); $password=mysql_real_escape_string($_post['password']);  mysql_query("insert formval('username','password') values('$username','$password')");  } ?> 

this should work

<?php $connection=mysqli_connect("localhost","root","","form") or die("not connected");   if($_post['username']!="" && $_post['password']!=""){    $username=mysqli_real_escape_string($connection,$_post['username']);   $password=mysqli_real_escape_string($connection,$_post['password']);     mysqli_query($connection,"insert formval(username,password)  values('$username','$password')");   } ?> 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -