Here's the html:
<form action="php/buzz_data.php" method="get">
<div>Image: <input type="text" name="buzz_img" size="30" /></div>
<div>Link: <input type="text" name="buzz_link" size="30" /></div>
<div>Description: <textarea rows="5" cols="30" name="buzz_desc"></textarea></div>
<div>Title: <input type="text" name="buzz_title" size="30" /></div>
<input type="submit" value="Submit" />
<input type="submit" value="Clear" />
</form>
Here's the php:
<?php
$con = mysql_connect("localhost","***","***");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ubook247", $con);
$sql="INSERT INTO buzz_data (buzz_page_title, buzz_img, buzz_link, buzz_desc, buzz_title)
VALUES
('$_POST[buzz_page_title]','$_POST[buzz_img]','$_POST[buzz_link]','$_POST[buzz_desc]','$_POST[buzz_title]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
and here's the result:
Notice: Undefined index: buzz_img in C:\wamp\www\ubook247\php\buzz_data.php on line 12
Notice: Undefined index: buzz_link in C:\wamp\www\ubook247\php\buzz_data.php on line 12
Notice: Undefined index: buzz_desc in C:\wamp\www\ubook247\php\buzz_data.php on line 12
Notice: Undefined index: buzz_title in C:\wamp\www\ubook247\php\buzz_data.php on line 12
1 record added
The db and table are both correctly set up as a new record was created, it just didn't add the data from the inputs.