- This topic is empty.
-
AuthorPosts
-
December 19, 2011 at 5:33 pm #35715
yashar
ParticipantHello,
I am working on a site which is in a different language, and have added a form to a page called request when clicked submit it is processed by a page called contact.php and so when the user has clicked submit they should be redirected to a page called thankyou.html letting them know that their message is sent, i have edited the php form so when i click submit the form is sent and i am redirected to the thankyou.html viewing my message is ent however the php is not collecting all the information from the request page because when i view the email i just see the subject line, and couple of the information collected, so please let me know how this issue can be solved, thanks.HTML,
PHP,
$nmachine = $_POST ;
$bmachine = $_POST ;
$zmachine = $_POST ;
$mdmachine = $_POST ;
$smachine = $_POST ;
$t1machine = $_POST ;
$yname = $_POST ;
$yp = $_POST ;
$ym = $_POST ;
$fax = $_POST ;
$email = $_POST ;
$t2machine = $_POST ;
$submit = $_POST ;
$sendTo = "[email protected]";
$subject = "company form";
$message = "$t1machine
from $yname, $yp";
$headers = "From: $yname <$email> rn";
$headers .= "X-Mailer:PHP/rn";
$headers .= "MIME-Version:1.0rn";
$headers .= "Content-type:text/plain; charset=iso-8859-1rn";
if(isset($submit)){
$sent = mail($sendTo, $subject, $message, $headers);
if ($sent) {
header("location:./thankyou.html");
}else{
echo "Message Failed";
}
}
?>December 19, 2011 at 7:54 pm #92987kresy
Memberi think is the mail function structure.
mail is structured like that : to, subject, message.
After message you can put additional headers informations.
so i think is better do like that ( this is a very quick and basic way ) :
$field1 = $_POST ;
$field2 = $_POST ;
if(isset($field1) && isset($field2)){
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html;charset=utf-8' . "rn";
$headers .= "From:Your site name";
$to= 'your email';
$subject= 'Email from etc...';
$message= "$field1 is the first field you type. $field2 is the second one.";
if(@mail($to, $subject, $message,$headers)){
header("Location: thanks.html");
}
else{
header("Location: error.html");
}
}else{
echo 'complete the form.';
}
?>i hope this is correct and helps you! :)
bye
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.