|
Posted by annie on 10/14/01 11:32
Looking to have this do a lookup into the db
Before it does the insert
If $email2 AND $site are in the data base stop tell the user he/she is
already entered.
If does not exisit then do the insert and send the email.
I have tried but failed
<?
include "common.php";
$email2= $_POST['email'] ;
$site= $_POST['site'] ;
$sql = "INSERT INTO `contest` (`id`, `email`, `link`) VALUES ('',
'$email2', '$site')";
$link = mysql_query($sql,$cn);
?>
<link rel="stylesheet" type="text/css" href="style.css">
<table border=0 cellspacing=0 cellpadding=5>
<tr>
<td width=250 bgcolor=#999999></td>
<td width=500 bgcolor=#EFEFEF>
<?php
// multiple recipients
$to = $_POST['email'] . ', webmaster@XXXXXXXXXXX.com'. "\r\n"; // note
the comma
// subject
$subject = 'Contest Entry From '. $_POST['email'] ;
// message
include "common.php";
$sql = "select message from email where id=2";
$link = mysql_query($sql,$cn);
$data = mysql_fetch_row($link);
//echo "$data[0]";
$message = $data[0];
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: ' . "\r\n";
$headers .= 'From: XXXXXXXXXXX.com <webmaster@XXXXXXXXXXXXXX.com>' . "\r
\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
<h2>Thanks!</h2>
Email has been sent to <?php echo $_POST['email']; ?>!
</td>
<td width=250 bgcolor=#999999></td>
</tr>
</table>
[Back to original message]
|