You are here: can any one help me with this Thanks « PHP SQL « IT news, forums, messages
can any one help me with this Thanks

Posted by annie on 10/02/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>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация