What's wrong with this? I'm not able to add anything to the database via the form. I'm a newbie so be easy.
Form code
php code
Form code
Code:
<form action="submit.php" method="post" >
<td width="34%"><span class="style6">Company name: </span></td>
<td width="66%"><label>
<input name="company" type="text" class="style6" size="35" maxlength="35" />
</label></td>
</tr>
<tr>
<td class="style6">Address:</td>
<td><input name="street" type="text" class="style6" size="35" maxlength="35" /></td>
</tr>
<tr>
<td class="style6">City:</td>
<td><input name="city" type="text" class="style6" size="35" maxlength="35" /></td>
</tr>
<tr>
<td class="style6">State:</td>
<td><input name="state" type="text" class="style6" size="35" maxlength="35" /></td>
</tr>
<tr>
<td class="style6">Zip:</td>
<td><input name="zip" type="text" class="style6" size="35" maxlength="35" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="style6">Phone:</td>
<td><input name="phone" type="text" class="style6" size="35" maxlength="35" /></td>
</tr>
<tr>
<td class="style6">Website:</td>
<td><input name="web" type="text" class="style6" size="35" maxlength="35"/></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="style6">Latitude:</td>
<td><input name="lat" type="text" class="style6" size="35" maxlength="35" /></td>
</tr>
<tr>
<td class="style6">Longitude:</td>
<td><input name="long" type="text" class="style6" size="35" maxlength="35" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="submit" />
</div></td>
</form>
php code
Code:
<?php
$dbh = mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
$sql="INSERT INTO database_name (lat,long,company,street,city,state,zip,phone,web)
VALUES ('$lat', '$long', '$company', '$street', '$city', '$state', '$zip', '$phone', '$web')";
$result = mysql_query($sql);
header("Location: [URL unfurl="true"]http://www.yahoo.com");[/URL]
exit();
?>