PHP help
Posted: Thu Jan 13, 2011 11:18 pm
I have tried and tried with this one. I have looked everywhere, and i keep coming up with the same thing. I am a newbie. I am only trying to get one field filled, "Beer Name" though there are quite a few input areas in the HTML. I keep getting either "beername" or ""(blanks) showing up. Thank you so much!
This is what I have in insert.php
This is what I have in insert.php
Code: Select all
<?php
$con = mysql_connect("localhost","name","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db_table", $con);
$sql="INSERT INTO table (beername)
VALUES
('beername')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
On website I have:
<html>
<body>
<form action="/wp-content/insert.php" method="post">
<P>
<LABEL for="beername">Beer Name: </LABEL>
<INPUT type="text" id="beername"><BR>
<LABEL for="brewery">Brewery: </LABEL>
<INPUT type="text" id="brewery"><BR>
<LABEL for="style">Style: </LABEL>
<INPUT type="text" id="style"><BR>
<P>Aroma<BR>
<TEXTAREA Name="aroma" rows="4" cols="20"></TEXTAREA>
<P>Appearance<BR>
<TEXTAREA Name="appearance" rows="4" cols="20"></TEXTAREA>
<P>Flavor<BR>
<TEXTAREA Name="Flavor" rows="4" cols="20"></TEXTAREA>
<P>Mouth Feel<BR>
<TEXTAREA Name="mouthfeel" rows="4" cols="20"></TEXTAREA>
<P>Overall Impression<BR>
<TEXTAREA Name="overallimpression" rows="4" cols="20"></TEXTAREA>
</P>
<INPUT TYPE=SUBMIT NAME="submitbeer" VALUE="SUBMIT">
</form>
</body>
</html>