Hey,
I've got a with a form which injects data into a table in a mysql database. The table is called subscribe. When users submit their details in a form the details aren't written into the table, just a new row is created, without any infomation. The code for the form is
<html>
<head>
<align><center><form action="subscribe.php">
<br>
<b><u>Clan Name:</u></b>
<input type="text" name="Clan">
<br>
<b><u>Contact Email:</u></b>
<input type="text" name="email">
<br>
<b><u>Clan Members</b></u>
<br>
<textarea name="members"></textarea>
<br>
<b><u>Clans Website</b></u>
<br>
<input type="text" name="WEBSITE">
<br>
Please check these details are all correct, and then
<input type=submit value=Submit>
</form>
</html>
</head></center>
The second file 'subscribe.php' code is as follows,
<?
//MySQL Variables. Edit where necessary
$host = "localhost";
$login_name = "xxxxxx";
$password = "xxxxxxx";
//Connecting to MYSQL
MySQL_connect("$host","$login_name","$password");
//Select the database we want to use
MySQL_select_db("knockou_knockout") or die("Could not select database");
$Clan=$_POST["Clan"];
$email=$_POST["email"];
$members=$_POST["members"];
$WEBSITE=$_POST["WEBSITE"];
$sql=("INSERT INTO subscribe SET
Clan=\"$Clan\",
email=\"$email\",
members=\"$members\",
WEBSITE=\"$WEBSITE\"
");
$result= mysql_query($sql);
if ($result) {
echo("Thank you, your details have been taken");
}else{
echo("There was an error. Please contact Michael or Sacul");
}
//MySQL_close()
?>
I was talking to someone else and they were saying that I should should use VALUE instead of SET.
The table subscribe has 4 columns, Clan,email,members,website.
If anyone can tell me why the infomation from the form is not being sent to the database, I would really appriciate it.
🙂