Why does my php form keep yielding empty rows in mysql? -
so trying create form puts data in table, , got work, when goes table, creates empty rows. here code, please me out.
form.php
<form action="tableinsert.php" method="post"> first name:<input type="text" name="fname"> <br/> last name:<input type="text" name="lname"><br/> username:<input type="text" name="uname"><br/> password:<input type="text" name="password"><br/> email:<input type="text" name="email"><br/> </form>
tableinsert.php
<?php $sc = mysqli_connect ("localhost" , "dbname" , "password"); if (mysqli_errno($sc)) { echo "sorry, couldn't connect database. if keep getting error, please email webmaster @ natashaharrell@hotmail.com " . mysql_error; } $si = "insert sdb_users (fname, lname, uname, password, email) values ('$_post[fname]' , '$_post[lname]' , '$_post[uname]' , '$_post[password]' , '$_post[email]' )"; if (!mysqli_query($sc, $si)) { echo "sorry there seems problem: " . mysqli_errno($sc) ; } else { echo "1 record added."; } mysqli_close($sc); ?>
try that
$si = "insert sdb_users (fname, lname, uname, password, email) values ('".$_post["fname"]."' , '".$_post["lname"]."' , '".$_post["uname"]."' , '".$_post["password"]."' , '".$_post["email"]."' )";
Comments
Post a Comment