ok,

my Hosting company have informed me that my new websites are on servers using php5 and the simple forms i have used on previous php4 based websites do not work.

So although i have pretty much zero knowledge of php i have searched around to find the answer to the problem. Well the answer to the problem seems to be it is something to with Global Variables.....that means zilch to me.

So if someone could take a look at this simple php4 code and then retype it for me in php5 compatible script im sure i could work out what to change on my other forms.

So for example lets take my page on my php4 website: http://www.weddingpartyinvitations.com/ContactUs.htm

We have a TextField called: Name
a TextField called: Email
a TextField called: Subject
a TextField called: Question

and a submit button called: Submit

it uses the code line: "<form id="QuickEnquiry" name="QuickEnquiry" method="post" action="QuickEnquiryMail.php">"

Then my php on the quick enquiry page looks like this:

<?
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input!");
}
}

$Name=$POST['Name'];
checkOK($Name);
$Email=$
POST['Email'];
checkOK($Email);
$Subject=$POST['Subject'];
checkOK($Subject);
$Question=$
POST['Question'];
checkOK($Question);


$to="info@myemailaddress";
$message="
A Quick Enquiry has been submitted from www.WeddingPartyInvitations.com
Here are the details:

Name: $Name
Email: $Email
Subject: $Subject
Question: $Question

";


if(mail($to,"Quick Enquiry: $Email $Name" ,$message,"From: $Email\n")) {
echo "";

} else {
echo; "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>

So if somebody could retype this php script for me in way that will work on php5 servers i would appreciate it. From here i can analyse the changes then fix the more complex forms myself.

I intend to use the same contact form here on my new website: http://www.weddingfavoursworld.com/Contact-Us.htm So once i have a workaround i can test it to see if it works.

So thanks in advance for any help.

    What is the error you get? I don't see any php4 or php5 difference here.

      Well the error is.. i simply get nothing sent to my email account.

      and i have tried various forms.

      The form works on a php4 server but not on a php5 server so there must be an error somehwere.

      I emailed the hosting company and they said everything was working fine at their end and the problem was that php 5 was more strict.

      Other people have had same problem and they said they fixed it by changing the Global Variables or something...whatever that means??

        Echo() out $message to see if the data is filled in correctly. If so, then contact your host and ask them how they propose you send out e-mails since mail() doesn't seem to be working.

        This probably has nothing to do with a PHP 4 vs. 5 issue, but rather a configuration that your host is responsible for.

          Write a Reply...