<?php
include_once("includes.php");
$selectedDealer = '';
unset($_SESSION['tradeup']);
if(isset($_POST['code']))
{
unset($_SESSION['tradeup']);
if(!isset($dealerInfo[strtolower($_POST['code'])]))
{
$_SESSION['register']['code'] = '';
$_SESSION['tradeupError'] = '* Invalid Code';
header("location: code.php");
exit;
}
else
{
$_SESSION['tradeup']['selectedDealer'] = strtolower($_POST['code']);
$_SESSION['selectedDealer'] = strtolower($_POST['code']);
$_SESSION['register']['code'] = $_SESSION['selectedDealer'];
header("location: index.php");
exit;
}
}
include_once('header.php'); ?>
<center>
<table cellspacing="0" cellpadding="0" style="width:100%">
<tr>
<td style="padding-top:70px;padding-left:40px;text-align:left">
<center>
<img src="images/codeTitle.png">
<div style="background-color:#efefef;padding-top:20px;text-align:left;padding-left:50px;padding-bottom:10px">
<form method="POST">
<center>
<table cellspacing="0" cellpadding="0" class="formTbl">
<tr>
<td style="vertical-align:middle;width:100px"><img src="images/code.png"></td>
<td style="padding:0px 10px"><input type="text" id="code" name="code" style="width:160px;height:40px;font-size:20pt" value="<?= $_SESSION['register']['code'] ?>"></td>
<td style="vertical-align:middle;"><input type="submit" style="height:40px;" value="Verify Code"></td>
</tr>
</table>
<?php
if(isset($_GET['prov']))
{
?>
<br>
<table cellspacing="0" cellpadding="0" class="formTbl" >
<tr>
<td style="text-align:right;padding-right:10pt;vertical-align:middle;width:250px;font-size:16pt;color:#ec3740;font-weight:bold;">WHERE DO YOU LIVE? </td>
<td style="text-align:left;vertical-align:middle;width:420px">
<select name="selProv" style="font-size:16pt">
<option value=""></option>
<option value="on">Ontario</option>
<option value="nb">New Brunswick</option>
</select>
</td>
</tr>
</table>
<?php
}
?>
</form>
<font style="color:red"><?= $_SESSION['tradeupError'] ?></font>
<br>
</div>
<img src="images/roundBottom.png">
</center>
</td>
</tr>
</table>
<br><br>
<?php include_once('footer.php'); ?>