contact-form to download pdf and send emails

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
baffled1003
Forum Newbie
Posts: 1
Joined: Tue Mar 15, 2011 5:40 pm

contact-form to download pdf and send emails

Post by baffled1003 »

Hello,

I need assistance regarding some code that i am working on. Maybe someone can help me?

here is the code:
here is the php file
====================================================================
<?php

$to = 'email<at>address1.com' . ', ';
$to .= 'emai<at>address2.com';
$from = $_POST['Email'] ;
$name = $_POST['Name'] ;
$companyname = $_POST['Company'] ;
$headers = "From: $from";
$subject = "Brochure Form Data";
$message = "Thank you for submitting a completed form! The form was submitted to $to!";
$output = header("Location:http://...../FIDIC-ch...


$fields = array();
$fields{"Name"} = "Name";
$fields{"Company"} = "Company";
$fields{"Email"} = "Email";


$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_POST[$a]); }

$headers2 = "From: email<at>address3.com";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at url";

if($from == '') {echo "You have not entered an email, please go back and enter an email address";}
else {
if($name == '') {echo "You have not entered a name, please go back and enter a name";}
if($companyname == '') {echo "You have not entered a company name, please go back and enter a company name.";}
else {
echo "Thank you for submitting a completed form! The form was submitted to $to!";
$send = mail($to, $subject, $body, $headers, $message);
$send2 = mail($from, $subject2, $autoreply, $headers2);}

if($send)
{header("Location:http://..../FIDIC-chr...
else
{echo "We encountered an error sending your mail, please notify webmaster<at>YourCompany.com"; }
}
?>
===============================================================

what i need assistance on is how to make the page load with the message: "Thank you for submitting a completed form! The form was submitted to $to!"
while the page loads as i click the submit button from the contact form, the pdf file opens up and the thank you greeting is not found....

Please help...URGENT!

Thanks,
A. Tirona
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: contact-form to download pdf and send emails

Post by yacahuma »

you talk about a pdf, but I dont see any in your code
Post Reply