mysql - insert form data into sql server database using PHP -


i beginner of web design. have database set , want insert form data database using php. have code these when click submit button goes php code page. need help. thanks

<!doctype html>  <html> <body>  <form name="input" action="test.php" method="post"> first name: <input type="text" name="firstname" value="mickey"><br> last name: <input type="text" name="lastname" value="mouse"><br> <input type="submit" value="submit"> </form>   <?php  if(isset($_post['sumit'])){  $fname=$_post['firstname'];   $lname=$_post['lastname'];   mysql_connect("server", "xxxxxx", "xxxxxx") or die(mysql_error());   mysql_select_db("test_name") or die(mysql_error());   mysql_query("insert `firstname`,'lastname' values ('$fname', '$lname')");   print "your information has been added database."; }  ?>    <p>if click "submit" button, form-data sent test table test_name.</p> 

<input type="submit" value="submit"> 

everything ok need add 1 attribue like

<input type="submit" value="submit" name="sumit"> 

missing table name

mysql_query("insert table_name (`firstname`,'lastname') values ('$fname', '$lname')");  

view w3schools tutorial


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -