Page 1 of 1

form submission

Posted: Tue Sep 13, 2005 12:25 am
by dru_nasty
The following isn't working, and I'm not sure why.

I've got a basic form to add email addresses

Code: Select all

<html> 
<head><title>Do Not Email</title></head> 
<body> 
    <form action="donotemailphp.php" method="POST">
Enter your email address to take your name off the list.<br><br>
<input type="text" name="email" size="30">
<p><input type="submit" name="submit" value="Submit"></p>
</form>
</body> 
</html>
and the donotemailphp.php file

Code: Select all

<?
include_once('/usr/home/fss/websites/fivestarsports.net/inc/func.inc.php');
$db_conn = five_connect_db();
mysql_select_db('fivestar',$db_conn);
$sql = "INSERT INTO donotemail(email) VALUES ('', '$_POST[email]')";
if (mysql_query($sql, $db_conn)) {
echo "record added!";
}else{
echo "something went wrong in database communication";
}
?>
Does anyone see anything wrong? I'm still a newb by the way.
Thanks.

Posted: Tue Sep 13, 2005 12:45 am
by feyd
you've told mysql you want to insert one field, but you give it two fields.

Posted: Tue Sep 13, 2005 12:52 am
by dru_nasty
ahh, that's it, thanks, it's working now! :D

Posted: Tue Sep 13, 2005 12:48 pm
by nickman013
can you please post the working php script... thanks alot!

Posted: Tue Sep 13, 2005 1:37 pm
by dru_nasty

Code: Select all

$sql = "INSERT INTO donotemail(email) VALUES ('$_POST[email]')";