sophielois
Technical User
Hi ,
Just starting to learn the simple things to do with PHP. Got a little problem.
I have a form which has a checked tick box so users can subscribe to newsletter
**This is just a extract from the form
on submit it goes to a script called post1.php
Having problems with this section:
Im basically trying to do the following:
If the check box is ticked and the email address is not already subscribed to the mailing list, insert email into the mailinglist table and continue with script. If the checkbox is ticked but the email address is already subscribed continue with the script
Everything works in the full script except i cant get the script to insert the email address into the mailing list
What am i doing wrong??
Thanks for any help that can be offered
Soph
Just starting to learn the simple things to do with PHP. Got a little problem.
I have a form which has a checked tick box so users can subscribe to newsletter
**This is just a extract from the form
Code:
<tr>
<td height="20" class="contactform">
<input name="mail" type="checkbox" style="border:0px;" value="mail" checked> Receive FREE Newsletter</td>
</tr>
on submit it goes to a script called post1.php
Having problems with this section:
Code:
<?
if(mail == "checked") {
$res = mysql_query ("SELECT COUNT(*) FROM mailinglist
WHERE email='email' ");
if (mysql_result($res,0)==0) {
mysql_query("INSERT INTO mailinglist (fullname, email, signup_date)
VALUES('$name', '$email', now())") or die (mysql_error());
}
}
?>
Im basically trying to do the following:
If the check box is ticked and the email address is not already subscribed to the mailing list, insert email into the mailinglist table and continue with script. If the checkbox is ticked but the email address is already subscribed continue with the script
Everything works in the full script except i cant get the script to insert the email address into the mailing list
What am i doing wrong??
Thanks for any help that can be offered
Soph