Ok im sory
This is my html form.
<table clas="rink_form">
<form method="post" action="form_survey.php">
<tr>
<td>
Rink Name: <input name="RinkName" type="text" class="form_text">
Rink Address: <input name="RinkAdress" type="text" class="form_text">
</td>
</tr>
<td>Enter code below:</td>
<td><img src="secimg.php"></td>
</tr>
<tr>
<td> </td>
<td><input type="text" name="Spam Code" size="8" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit Form">
</td>
</tr>
</form>
</table>
And my script
<?php
function checkEmpty($names, $data) {
$n = count($names);
$emptys = array();
for ($i = 0; $i < $n; $i++) {
if (empty($data[$names[$i]])) $emptys[] = $names[$i];
}
return $emptys;
}
function createUList($arr) {
$n = count($arr);
echo '<ul>';
for ($i = 0; $i < $n; $i++)
echo " <li>".str_replace('_',' ',$arr[$i])."</li>\n";
echo '</ul>';
}
// needed so we can retrieve security code
session_start();
//This command imports the values from contact.php. Please do not touch.
@import_request_variables("gpc");
//The email address the message will be sent to
$youremail = "mymail@yahoo.com";
//The subject of the email you will receive;
$subject = "Ice Rink Supply - Survey Assessment Form";
//The page your visitor will be redirected to.
$redirect = "http://www.google.com";
//Time until the page redirects your visitor (seconds)
$secs = "5";
//This takes all of the information from the form and sorts it out. Please leave as is.
$name= $FONT_SIZE;
$FONT_SIZE=14;
$thetext=$thetext."<html><body>\n";
foreach ($_POST as $name => $value)
{
$name = str_replace('_',' ',$name);
$thetext=$thetext."$name : <b>$value</b>\n<br/>";
}
$thetext=$thetext."</body></html>";
?>
<html>
<head> </head>
<body>
<?php
//Checks to see if the name field is empty. You can delete or add fields as needed.
// fill $infoToCheck with info that NEEDS to be filled. Spam_Code is always needed here
$infoToCheck = array("RinkAdress");
$emptyFlds = checkEmpty($infoToCheck,$_POST);
$validSecurityCode = md5($_POST['Spam_Code']) == $_SESSION['key'];
// to make displaying invalid spam code msg easier
if (!$validSecurityCode) $emptyFlds[] = "Spam Code (invalid)";
$noEmptyFlds = count($emptyFlds) == 0;
if ($noEmptyFlds && $validSecurityCode)
{
unset($_SESSION['key']); // prevent multiple send
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* <-- the ff. lines are optional
$headers .= "From: ".$myname."
<".$myemail.">\r\n";
$headers .= "To: <".$email.">\r\n";
$headers .= "Reply-To: ".$myname."
<$myemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
*/
$name = stripslashes($name);
$message = stripslashes($message);
//This is where the email is sent using your values from above.
mail($youremail,$subject,$thetext,$headers);
?>
<meta http-equiv="refresh" content="<?=$secs;?>;URL=<?=$redirect;?>">
<font size="+1">
<p align="center" class="prod_h1" style="color:#FFFFFF" >Thank you, we have recieved your Assessment Form.</p>
<p class="rink_form" align="center" style="color:#FFFFFF">
You are now being redirected to our <a href="<?=$redirect;?>" style="color:#00CCFF">homepage</a>.
</font>
<?
}
else
{
?>
<font size="+1">
We require the ff. in order to reply to your message: <br/> </font>
<?php
if (!$noEmptyFlds) createUList($emptyFlds);
?>
<center>
<font color="#FFFFFF" size="+1">
Please click <a href="javascript:history.back(1);" style="color:#00CCFF">here</a> or your browsers back button to try again.
</font> <br/> <br/>
</center>
<?
}
?>
</body>
</html>
Is there something that i mess up?