Finally after spending two days on this and with help from everyone from Stack Overflow we've manage to get this working. Thank you for all your hard work guys and talking me through step by step!
We are trying to get the following code to work currectly,
It needs to A. Check Activation code is NULL and if so move the user to one of the forms B. If Check Activation comes back other than NULL it should tell the user to try another activation code. I know this is pretty simple but we can't seem to see the issue.
<?php
$username = $_POST['username'];
$activation_code = $_POST['activation_code'];
$activation_codeurl = $activation_code;
$usernameurl = $username;
$db_host = "localhost";
$db_name = "aardvark";
$db_use = "aardvark";
$db_pass = "aardvark";
$con = mysql_connect("localhost", $db_use, $db_pass);
if (!$con){
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_name, $con);
$checkcustomer = mysql_query("SELECT `Check_Activation` FROM `members` WHERE `Username` = '".mysql_real_escape_string($username)."' AND `Activation` = '".mysql_real_escape_string($activation_code)."'; ");
$array = mysql_fetch_array($checkcustomer);
if (!$array === false)
{
$username = substr($username, 0, 1);
if($username == '1') {
$redirect_url='form-one.php?membernumber='.$usernameurl.'&activation_code='.$activation_codeurl;
} elseif($username == '2') {
$redirect_url='form-two.php?membernumber='.$usernameurl.'&activation_code='.$activation_codeurl;
} elseif($username == '3') {
$redirect_url='form-three.php?membernumber='.$usernameurl.'&activation_code='.$activation_codeurl;
}
header("Location:". $redirect_url);
}
else
{
?>
<html>
<head>
<link rel='stylesheet' id='style-css' href='css/style.css' type='text/css' media='all' />
<meta name="viewport" content="width=960, initial-scale=0.32">
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<link rel="shortcut icon" href="http://welovebarrio.com/favicon.gif">
<link rel="icon" href="http://welovebarrio.com/favicon.gif" type="image/gif">
<title>Friends of BARRIO</title>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-35015193-1']);
_gaq.push(['_setDomainName', 'welovebarrio.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div class="inner-wrapper stage-one">
<div class="barrio-logo">Friends of Barrio</div>
<div class="barrio-wel-message">
<h1>Welcome Friends of Barrio</h1>
<span>-</span>
<h2>Enter a valid membership number<br/> and activation code to continue</h2>
</div>
<form name="form1" method="post" action="check-activation.php" class="membership-form">
<h3>Your membership number</h3>
<input name="username" type="text" id="username" value="<?php echo $username; ?>" class="membership-number">
<h3>our activation code</h3>
<input name="activation_code" type="text" id="activation_code" value="<?php echo $activation_code; ?>" class="activation-code">
<input type="submit" name="Submit" value="Continue" class="membership-continue">
</form>
</div>
<div class="error-message">
<span>Your membership number & activation code <br/>is not valid, please check and re-enter</span>
</div>
<div class="background-tl"></div>
<div class="background-tr"></div>
<div class="background-bl"></div>
<div class="background-br"></div>
</body>
</html>
<?php
}
$con->close();
?>