the code below is for a simple email submit form, it has two fields but for some reason i can't fathom why it does not work properly.
i am fairly new to PHP so any help would be appreciated.
my site is http://members.lycos.co.uk/tcdesign04
<?
//check for required form variables
if ((!$POST[email]) || (!$POST[club])) {
header("Location:http://members.lycos.co.uk/tcdesign04/regerr1.html");
exit;
}else {
}
//set up table and database names
$db_name ="newsletter_register";
$table_name ="register_interest";
//connect to server and select database
$connection = @mysql_connect("localhost","motorsportvip","motorsportvip") or die(mysql_error());
$db = @mysql_select_db($db_name,$connection) or die(mysql_error());
//Code to check that email address which is being registered is NOT all ready registered.
$sql = "SELECT email FROM $table_name WHERE email = '$_POST[email]'";
$result = @($sql,$connection) or die(mysql_error());
$num = @mysql_num_rows($result);
if ($num > 0)
{
header("Location:http://members.lycos.co.uk/tcdesign04/regerr2.html");
exit;
}
else
{
}
//build and issue query
$sql = "INSERT INTO $table_name (id, email, club) VALUES ('', '$POST[email]', '$POST[club]')";
$result = @($sql,$connection)or die(mysql_error());
?>
<html>
<link rel=stylesheet href="pagestemplate.css">
<style type="text/css">
<!--
.style1 {
font-size: 24px;
font-family: verdana;
color: #000000;
font-weight: bold;
}
.style2 {
font-family: verdana;
font-size: 12px;
color: #000000}
.style3 {
font-family: verdana;
font-weight: bold;
text-decoration: blink;
}
-->
</style>
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>The NLP</title>
<!-- TemplateEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<script language="javascript" src="sniffer.js">
//Top Navigational Bar III v3.4.1.1b (By BrotherCake @ cake@brothercake.net)
//Permission granted/modified by Dynamicdrive.com to include script in archive
//For this and 100's more DHTML scripts, visit http://www.dynamicdrive.com/
//This notice MUST stay intact for legal use
</script>
<script language="javascript1.2" src="custom.js"></script>
<script language="javascript1.2" src="style.js"></script>
</head>
<body background="background.gif">
<span class="links1">
<table width="400" cellpadding="0" cellspacing="20" border="0">
<tr><td class="style1">Thank You!..</td></tr>
<tr><td class="style2">For registering to recieve the Non-League Papers weekly newsletter.</td></tr>
<tr><td class="style3"><a href="index.html">Back</a></td></tr>
</table>
</span>
<span class="title">
<img src="title.gif">
</span>
<span class="pagetitle">
<table width=200 height=20>
<tr><td><div class="font1">Error!</div></td></tr>
</table>
</span>
<span class="bar2">
<img src="bar2.gif">
</span>
<span class="bar3">
<img src="bar4.gif">
</span>
<span class="ad1">
<table cellspacing=10>
<tr><td><img src="ad1.gif"></td></tr>
<tr><td><img src="ad2.gif"></td></tr>
<tr><td><img src="ad3.gif"></td></tr>
<tr><td><img src="ad4.gif"></td></tr>
<tr><td><img src="ad5.gif"></td></tr>
<tr><td><img src="ad6.gif"></td></tr>
<tr><td><img src="ad7.gif"></td></tr>
</table>
</span>
<span class="ad2">
<img border=0 src="398x60ad.gif">
</span>
<span class="ad3">
<img border=0 src="198x400ad.gif">
</span>
<span class="copyright">
<table width=200 cellpadding=0 cellspacing=0 border=0>
<tr><td><div class="font6">Site Designed and Maintained by <a href="http://www.geocities.com/tcdesign04"><b>TCDesign</b></a>.<br>
All content © Copyright 'The Non-League Paper'. <br>All views and opinions expressed on this site are of the individuals concerned and not necessarily those of The Non League Paper.</div></td></tr>
</table>
</span>
<script language="javascript1.2" src="menu.js"></script>
</body>
</html>