Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
Although I have coded in ASP, I have not really done anything in PHP. Recently I redid my company website. There were a couple of pages that were PHP. Instead of going through it I just changed the HTML so that it fit in with the rest of the site. Recently we switched to a new host and moved all our files. The PHP page is no longer functioning properly. This is the problem.
User is on an HTML page with a form. He fills out the form and the information is supposed to be sent in an email (via GET) and he is redirected to a new page. Now all that works fine except that all the variables in the email are blank. It goes to the right email address, and the date is correct as well as all the text, like Name: Last Name: etc. but the variables are just blank. Now when going from one page to the next, all the variables are displayed in the web address, so the problem is not in the HTML form page, but rather the variables are for some reason not being picked up.
Now, like I said, I am not familiar with PHP. So I researched a bit online and notices the variables were not being grabbed properly. So I changed to code to $_GET[first_name]; etc. But when I did this, although the variables still showed up in the address, the page being redirected to was blank and the email not sent.
I am really confused. What could have gone wrong in changing it from one host to the next? The following is the PHP code:Code: Select all
<?php
function doError($errString) {
include($header);
echo "$errString<BR><BR>\n";
include($footer);
exit;}
$today = date ("F j, Y g:i:s a");
$strMessageBody = "";
$strMessageBody .= "New Download Request:\n";
$strMessageBody .= "\n";
$strMessageBody .= "Registration Date: $today \n";
$strMessageBody .= " \n";
$strMessageBody .= "Information: \n";
$strMessageBody .= "-------- \n";
$strMessageBody .= " $ntitle $firstname $surname \n";
$strMessageBody .= " Company: $company \n";
$strMessageBody .= " Job Title:$jobtitle \n";
$strMessageBody .= " Phone: $phone \n";
$strMessageBody .= " eMail: $email \n";
$strMessageBody .= " \n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$myname."\" ".$myemail."\n";
//# Send email order to you...
$mailheaders = "From: info@whatever.com\r\n";
$mailheaders .="X-Mailer: PHP Mail generated by http://www.Whatever.com\r\n";
$subject = "New Lead for Whatever";
//echo "sending email";
mail($mail, $subject, $strMessageBody, $headers);
//echo $email;
$fd = popen("/usr/sbin/sendmail -t -f john@whatever.com","w");
fputs($fd, "To: mary@whatever.com \n");
fputs($fd, "From: info@whatever.com \n");
fputs($fd, "Subject: Whatever\n");
fputs($fd, "X-Mailer: PHP3\n");
fputs($fd, "$strMessageBody\n");
pclose($fd);
?>awieds
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]