Hey,
Ok set up a simple form to send to myself, now it works on one server, but not the other. Can anyone see anything in my code that might not like newer/older versions of PHP?
<?
// form not yet submitted
// display initial form with values pre-filled
if (!$submit)
{
?>
Email</span></p>
<p>* = Required Field</p>
<form action="<? echo $PHP_SELF; ?>" method="POST">
<p> * Your Name<br>
<input name="Name" type="text" size="70">
</p>
<p>Address<br>
<input name="Address" type="text"size="70">
</p>
<p>* Phone Number<br>
<input name="PhoneNumber" type="text" size="70">
</p>
<p>* Email Address<br>
<input name="Email" type="text"size="70">
</p>
<p>Information Required?<br>
<select name="Information" id="Information">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</p>
<p>Questions/Comments<br>
<textarea name="QandC" cols="70" rows="10"></textarea>
<br>
<br>
<input type="Submit" name="submit" value="Add">
</p>
</form>
<?
}
// form submitted
// start processing it
else
{
// set up error list array
$errorList = array();
$count = 0;
// validate text input fields
if (!$Name) { $errorList[$count] = "Please provide name"; $count++; }
if (!$PhoneNumber) { $errorList[$count] = "Please provide phone number"; $count++; }
if (!$Email) { $errorList[$count] = "Please provide email"; $count++; }
// check for errors
// if none found...
if (sizeof($errorList) == 0)
{
$from = "$Name <$Email>";
$headers .= "From: $from\r\n";
$email_to = "chris@yduk.net";
$subject = "Test";
$message = "Dear $Name,\n\nThank you.";
mail($email_to, $subject, $message, $headers);
echo "<p>Email Successfully Sent!</p>";
}
else
{
// errors occurred
// print as list
echo "<p class='Normal'>The following errors were encountered: <br></p>";
echo "<ul>";
for ($x=0; $x<sizeof($errorList); $x++)
{
echo "<li class='Normal'>$errorList[$x]";
}
echo "</ul>";
echo "<p>Email could not be sent! <br><br> <a href=javascript:history.back(-1)>Please go back and try again</a>.</p>";
}
}
?>
Any ideas?