When i do this insert, my ID will insert to my MySQL db but the rest of my fields are blank. Here are my two pages of code:
Page One:
insert.htm
Code: Select all
<html>
<head>
</head>
<center>
<form method="post" action="script.php">
<input type="hidden" name="id" value="null">
<table>
<tr><td align="left">First</td>
<td><input type="text" name="first"></td>
</tr>
<tr><td align="left">Last</td>
<td><input type="text" name="last" size="20"></td>
</tr>
<tr><td align="left">Phone</td>
<td><input type="text" name="phone" size="20"></td>
</tr>
<tr><td align="left">Mobile</td>
<td><input type="text" name="mobile" size="20"></td>
</tr>
<tr><td align="left">Fax</td>
<td><input type="text" name="fax" size="20"></td>
</tr>
<tr><td align="left">E-Mail</td>
<td><input type="text" name="email" size="20"></td>
</tr>
<tr><td align="left">Web</td>
<td><input type="text" name="web" size="20"></td>
</tr>
<tr><td colspan="2">
<p align="center">
<input type="submit" value="Enter record">
</td>
</tr>
</table>
</form>
</center>
</html>script.php
Code: Select all
<?
$username="username";
$password="password";
$database="tutorial";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO contacts VALUES('$id','$first','$last','$phone','$mobile','$fax','$email','$web')";
mysql_query($query);
mysql_close();
print "<html><body><center>";
print "<p>You have just entered this record<p>";
print "First Name : $first<br>";
print "Last Name : $last<br>";
print "Phone : $Phone<br>";
print "Mobile : $mobile<br>";
print "Fax : $fax<br>";
print "E-mail : $email<br>";
print "Web : $web<br>";
print "</body></html>";
?>