I'm learning to put values into my db from php. this is my simple form i wrote to test (its in a table)
<form action="connect2db.php" method="post">
<table width="500" border="0">
    <tr>
        <td width="200">first name:</td>
        <td><input type="text" width="258" name="fname" id="fname"/></td>
    </tr>
    <tr>
        <td width="200">last name:</td>
        <td><input type="text" width="258" name="lname" id="lname"/></td>
    </tr>
    <tr>
        <td>
        your email address: 
        </td>
        <td>
        <input type="text" width="258" name="email" id="email"/>
        </td>
    </tr>
    <tr>
        <td width="200">Your message:</td>
        <td><textarea rows="5" cols="45" name="mssg" id="mssg" ></textarea></td>
    </tr>
    <tr>
        <td><input type="submit"></td>
    </tr>
</table>
</form>
everything works as far as page 1 sending the values to page 2, and echoing them out. but when its time to insert them into the db table. its not working. this is the php code:
when i do a SELECT * FROM myTableNameHere, it says "empty set", when i enter the values manually via terminal to test, i get the values fine.
here is my simple code:
<?php 
$connection = mysql_connect("127.0.0.1","root","passhere"); 
if(!$connection) {
    die("database connection failed you fool!: FIX IT!" . mysql_error()); } 
$db_select = mysql_select_db("storeemail",$connection);
if(!$db_select){
    die("database selection failed." . mysql_error()); }
    else{ echo "connection made ";
    }
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body>
<?php
$to = 'email@gmail.com';
$subject = 'test from my email php script';
$email = $_POST['email'];
$name = $_POST['fname'];
$lastname = $_POST['lname'];
$mssg = $_POST['mssg'];
$insertData = mysql_query("INSERT into myusers(firstname, lastname) 
VALUES ('$name', '$lastname', '$email', '$mssg');");
 mysql_close($connection) 
?><br/>
your first name is - <?php echo $name; ?><br/>
your last name is - <?php echo $lastname ; ?><br/>
your message to send is - <?php echo $mssg; ?> <br/>
</body>
</html>
 
     
     
     
     
    