I managed to get my page correctly checking for a cookie and conditionally
displaying the page as intended. To do this I got some advice which included
changing the action attribute of the form tag which now results in an empty
value and therefore doesn't execute the form to email script.
Can anyone explain why I need that value for the action attribute to ensure
the cookie is being checked for and why if I use an action attribute such as
action="cgi-bin/formtomailscript2.cgi" the cookie checking doesn't work.
I have included the relevant code below.
Appreciate suggestions for what is the problem here.
Thanks
David
<h1>Free resources</h1>
<?
if (isset($COOKIE['email'])) {
?>
<ul><li><a href="#">Access free resources</a></li></ul>
<?
} elseif ($GET['checkit']) {
echo "<ul><li><a href="#">Access free resources</a></li></ul>";
}
else {
?>
<p>Please enter your email address below to access the free SMILE
resources.</p>
<form name="emailaddress" id="emailaddress" title="Email address"
onsubmit="return formvalidation();" method="post" action="<? echo
$_SERVER['cgi-bin/formtomailscript2.cgi']; ?>">
<table id="emailtable">
<tr>
<td class="input"><input name="email" id="email" type="text" size="23"
/></td>
</tr>
<tr>
<td>
<div align="center">
<input name="submit" id="submit" type="submit" value="submit" />
</div>
</td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
<!--
document.getElementById('email').focus();
// -->
</script>