I've shortened the code a bit to try and figure out what's going on. I thought it might have fixed it but it's still sending the email twice. I have NO IDEA whats going on with this and driving me mad.
I am calling this page by
header("location: registerc.php");
Could this have something to do with it?
<? session_start();
include("connect.php");
$p_result = mysql_query("SELECT * FROM personal_details WHERE userid='$user'");
$p_row = mysql_fetch_row($p_result);
$l_result = mysql_query("SELECT * FROM login WHERE userid='$user'");
$l_row = mysql_fetch_row($l_result);
include("header.php");
include("tab3.php");
$nav_title="Open An Account";
include("navbar.php");
?>
<div class="progressbar">
<div style="float:left; margin-right:20px;">1. Enter Information</div>
<div style="float:left; margin-right:20px;"><b>2. Verify Information</b></div>
<div style="float:left; margin-right:20px;">3. Check Email</div>
</div>
<div class="content">
<h1>Verify Information</h1>
<div class="divider"></div>
<?
$body = "Hello $p_row[1] $p_row[2], \n\n";
$body .= "Click the link below to activate your Auction.Beta account: \n\n";
$body .= "http://www.argyllnewmedia.co.uk/auction/validate.php?u=$l_row[0]&v=$l_row[3] \n\n";
$body .= "If you're unable to click the link above, cut and paste it into your web browser. \n\n";
$body .= "Should you forget your password, you can request a new one which will be sent to this email address. \n\n";
$body .= "Thank you for registering. \n\n\n";
$body .= "Auction.Beta Team \n\n";
$from = "registration@auction.co.uk";
$mailheader = "From: $from\r\n";
mail("$l_row[2]","Auction.Beta Registration","$body","$mailheader");
echo "We just sent an email to <b>$l_row[2]</b> to verify your registration. It contains a link you'll need to
follow to confirm your email address. Please check your email now.<br><br>";
?>
<p>If you do not receive the message in the next 10 minutes, you can <b>
<a class="bluelink" href="registerc.php">request another verification email.</a></b></p>
<p>If you've been waiting for over 15 minutes:
<ol>
<li>Make sure you have entered the correct email address</li>
<li>Make sure your spam filter allows email from "registration@auction.beta"</li>
<li>Request the verification email again</li>
</ol></p>
<p>For your records, here are your account details:</p>
<div class="inner_content">
<div class="mailing"><b>Address</b><br><? echo "$p_row[1] $p_row[2]"; ?></div>
<div class="mailing"><? echo $p_row[3]; ?></div>
<div class="mailing"><? echo $p_row[4]; ?></div>
<div class="mailing"><? echo $p_row[5]; ?></div>
<div class="mailing"><? echo $p_row[6]; ?></div>
<div class="mailing"><? echo $p_row[7]; ?></div>
<div class="mailing"><br><b>User Name</b><br><? echo $l_row[0]; ?></div>
<div class="mailing"><br><b>Password</b><br><? echo $l_row[1]; ?></div>
<div class="mailing"><br><b>Sectret Question</b><br><? echo $l_row[4]; ?></div>
<div class="mailing"><br><b>Sectret Answer</b><br><? echo $l_row[5]; ?></div>
</div>
</div>
<? include("footer.php"); ?>