Hi,
I have the problmen that the user always get the message that he is in the mailing list.
The $check returns Resource id #3
but ofcourse it must be the mail adres that i requested in the search... What can it be?
Thnx For the help 🙂
Aron.
<?php require_once('database.php'); ?>
<?php require_once('database.php'); ?>
<?php
if(isset($_POST['contact']))
{
$name = strip_tags($_POST['name'], '');
$email = strip_tags($_POST['email'], '');
// $email = $_POST['email'];
$subject = strip_tags($_POST['subject'], '');
$bericht = strip_tags($_POST['message'], '');
$bedrijf = strip_tags($_POST['company'], '');
$telnr = strip_tags($_POST['phonenr'], '');
// checkbox checking
if (isset($_POST['mailing'])) {
$maillijst = "1";
}
else {
$maillijst = "0";
}
//Mail gedeelte
// You, the recepient
$to = "$mailadres";//yourname and email address
// Addtional headers
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $name <$email>\r\n";
// Message body
$message = "$bedrijf \r\n";
$message .= "$name \r\n";
$message .= "$email \r\n";
$message .= "$telnr \r\n";
$message .= "$subject \r\n";
$message .= "$bericht \r\n";
mail($to, $subject, $message, $headers);
header("Refresh:5; URL = $redir");///"your thankyou url
echo "$bedankt";//write your thanks message
// database gedeelte
mysql_connect("$hostname", "$user", "$password") or die("Kan geen verbinding maken: " . mysql_error());
mysql_select_db("$db");
$check = mysql_query ("SELECT * FROM gegevens WHERE email='$email' ");
echo $check;
if ($check){
echo "U staat al in de mailing lijst";
}else{
$klanten = "insert into gegevens values ('$bedrijf', '$telnr', '', '', '', '$name', '', '$email', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '$maillijst', '', '', '', '')";
mysql_query($klanten) or die(mysql_error());
mysql_query("COMMIT");
}
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<table align="center" border="0" width="756" cellpadding="5" cellspacing="2">
<tr bgcolor="#FFFFFF">
<td style="border:1px solid #1C82B0;" width="550" valign="top">
<form name="contactform" action="<?php echo $_SERVER['PHP_SELF']; ?>"
method="post" onSubmit="return checkForm();">
<table border="0" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td width="98">Your Name:</td>
<td width="430" valign="middle"><input type="text" name="name" size="25" ></td>
</tr>
<tr>
<td valign="middle">Your company </td>
<td><input name="company" type="text" id="company" size="25" ></td>
</tr>
<tr>
<td valign="middle">Telefoonnummer</td>
<td><input name="phonenr" type="text" id="phonenr" size="25" ></td>
</tr>
<tr>
<td valign="top">Your Email:</td>
<td><input type="text" name="email" size="25" ></td>
</tr>
<tr>
<td>Subject:</td>
<td><input type="text" name="subject" size="25" ></td>
</tr>
<tr>
<td>Message: </td>
<td><textarea name="message" cols="55" rows="14"></textarea></td>
</tr>
<tr>
<td>Mailing</td>
<td><input name="mailing" type="checkbox" value="1" checked>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="contact" value="Send Message"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>