Jump to content

Recommended Posts

I have one form created and posted on 2 seperate servers thats running 2 different versions of php.

 

On this version: http://206studios.com/php.php everything works perfectly fine.

 

but on this version: http://scanwestauto.com/2007/info.php all my variables come up empty.  None of the variables get passed into the email, i just get blanks for all fields inputed on the form.

 

Which properties in the PHP should i be looking for to get the second version working like the first?

 

Any help would be much appreciated.

 

Thanks,

George

Link to comment
https://forums.phpfreaks.com/topic/63387-simple-php-contact-form-not-working/
Share on other sites

The following is the script i used for the contact form, its really straight forward, but for some reason just not working properly on that second version (http://scanwestauto.com/2007/info.php):

 

<?php

 

$to ='ampm@hotmail.com';

 

$subject ="Scanwest Mailing List Reply";

 

$content="FIRST NAME: $f_name" . "\r\n" . "LAST NAME: $l_name"

 

$mail_from="$email";

 

$header="From: $name <$mail_from>";

 

$send_contact=mail($to,$subject,$content,$header);

 

if($send_contact){

echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='."thankYou.html".'">';

}

else {

echo "ERROR";

}

?>

I found an error

 

<?php

$to = 'ampm@hotmail.com'; 

$subject = "Scanwest Mailing List Reply"; 

$content = "FIRST NAME: $f_name" . "\r\n" . "LAST NAME: $l_name";

$mail_from = "$email"; 

$header="From: $name <$mail_from>"; 

$send_contact = mail($to,$subject,$content,$header);

if($send_contact) {
echo '<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=\'.\"thankYou.html\".\'\">';
}
else {
echo "ERROR";
}
?>

Try that. The last bit of code may be wrong, Im not sure. but i fixed the missing ;

The problem with 'blank variables' is caused because your script assumes that register_globals is ON.  That php setting is a potential security problem and OFF is the default setting in recent releases of php.

 

Your form processing script needs to retrieve the passed variables from the array sent by the form.  For example, if your form method is post, then $name = $_POST['name'] will retrieve the variable correctly.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.