Database .php
Posted: Thu Oct 06, 2011 10:45 am
I have a issue with my subscribe.php
i want when a email is typed in the text box to put the email in the database
though it isnt going there, here is the code
though if you can help me i will pay you BIG TIME
if you can use teamviewer add me on msn
therealmattbrown@hotmail.com
thanks
i want when a email is typed in the text box to put the email in the database
though it isnt going there, here is the code
Code: Select all
<?php
if(isset($_POST['add'])){
require_once('mysqlCreds.php');
$email = $_POST['email'];
if($email == ''){
header('Refresh: 5; url=http://szeryk.com/homepage');
echo "<div style='color: #FFFFFF;'>Please enter an email address to subscribe.</div><br />";
echo "<div style='color: #FFFFFF;'>If you aren't re-dreicted in a few seconds please click <a href='http://szeryk.com/homepage'>here</a></div>";
}
$result = mysql_query("SELECT * FROM emailList WHERE email='$email' LIMIT 1")or die(mysql_error());
while($row = mysql_fetch_array($result)){
if($row['email'] == $email){
header('Refresh: 5; url=http://szeryk.com/homepage');
echo "<div style='color: #FFFFFF;'>We are sorry, but this Email address is already subscribed.</div><br />";
echo "<div style='color: #FFFFFF;'>If you aren't re-dreicted in a few seconds please click <a href='http://szeryk.com/homepage/'>here</a></div>";
mysql_query("INSERT INTO emailList (id, email) VALUES('', '$email') ")or die(mysql_error());
header('Refresh: 5; url=http://szeryk.com/homepage');
echo "<div style='color: #FFFFFF;'>Thank you for subscribing to the newsleter!</div>";
echo "<br />";
echo "<div style='color: #FFFFFF;'>If you aren't re-dreicted in a few seconds please click <a href='http://szeryk.com/homepage'>here</a></div>"; }
}
}
?>
if you can use teamviewer add me on msn
therealmattbrown@hotmail.com
thanks