PDA

View Full Version : personal contact form: the php works in php4 but not php5



mightyj
March 15th, 2007, 02:42 PM
I have an old contact form that used to work in a php4 environment ,but now that i have upgraded my servers it does not, can anyone let me know what may be causing the issue. Here is the code:



<?php

// headers for the email listed below

$headers .= "From: $name <$email>\n"; // your email client will show the person's email address like normal
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; // sets the mime type
$recipient = "jordan@mighty55.com, chicatiff@gmail.com, chicatiff@aol.com"; // enter YOUR email address here
$subject = "**Message From The S.E. Website"; // this is the subject of the email

$msg = wordwrap( $msg, 1024 );

mail($recipient, $subject, stripslashes($msg), $headers); // the mail() function sends the message to you

//Once the data is entered, redirect the user to give them visual confirmation
header("location:sent.html");
?>

The functionality works and even gets sent to the sent.html page but when I get the email there is no data.

mightyj
March 15th, 2007, 02:53 PM
and the html page code in case needed (only included needed form info):


</script>
<script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{
if (theForm.name.value == "")
{
alert("Please enter a value for the \"name\" field.");
theForm.name.focus();
return (false);
}
if (theForm.email.value == "")
{
alert("Please enter a value for the \"email\" field.");
theForm.email.focus();
return (false);
}

if (theForm.email.value.length < 5)
{
alert("Please enter at least 5 characters in the \"email\" field.");
theForm.email.focus();
return (false);
}

if (theForm.email.value.length > 35)
{
alert("Please enter at most 35 characters in the \"email\" field.");
theForm.email.focus();
return (false);
}

if (theForm.msg.value == "")
{
alert("Please enter some text in the \"comments\" field.");
theForm.msg.focus();
return (false);
}
return (true);
}
//--></script>
<style type="text/css">

//
//

<form method="POST" action="contact.php" onSubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
<table width="379" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="113" align="right" valign="top" class="regular_text">Your Name: </td>
<td valign="top" align="left"><input name="name" type="text" class="regular_text" size="31" maxlength="200" /> </td>
</tr>
<tr>
<td align="right" valign="top" class="regular_text">Your Email:</td>
<td valign="top" align="left"><input name="email" type="text" class="regular_text" size="31" maxlength="100" /> </td>
</tr>
<tr>
<td align="right" valign="top" class="regular_text">Your Comments: </td>
<td valign="top" align="left"><textarea name="msg" cols="29" rows="4" class="regular_text"></textarea> </td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top" align="left"><input name="Reset" type="reset" class="button_text" value="Reset" />
<input name="Submit" type="submit" class="button_text" value="Submit" /> </td>
</tr>
</table>
</form></td>

bwh2
March 15th, 2007, 02:57 PM
it's most likely not a php version problem, but rather a mail settings problem.

mightyj
March 15th, 2007, 03:01 PM
can you further explain this.

mightyj
March 15th, 2007, 04:41 PM
it ended up being that my server had turned off global variables. I'll recode later but was able to enable globals.