Jump to content

Is my problem in the php?


tonyb6000

Recommended Posts

Hi

Uber newbie here. A guy wrote this code for me to put in a website I built. I did that, but something odd happens. Its a booking request form for a dentists practice. The emails are received in the webmail inbox in a browser, but not by the clients Outlook. Is the problem in the php, the hosts server settings, or the clients Outlook settings! Go figure...

 

Here's the code:

 

<?php

ini_set("sendmail_from", " [email protected] ");

 

if(count($_POST) > 0){

$name = getPost('name');

$address  = getPost('address');

$contact_tel = getPost('contact_tel');

$postcode = getPost('postcode');

$email   = getPost('submit_by');

$day   = getPost('day');

$time   = getPost('time');

$current  = getPost('current');

$how_found = getPost('how_found');

if(($name != "") and (($email != "") or ($address != "") or ($contact_tel != ""))){

$body = "Name:- ".htmlentities($name)."\r\n\r\n

Contact number:- ".htmlentities($contact_tel)."\r\n\r\n

Home address:- ".htmlentities($address)."\r\n\r\n

Postcode:- ".htmlentities($postcode)."\r\n\r\n

Email address:- ".htmlentities($email)."\r\n\r\n

On what day would you like to see us?:- ".htmlentities($day)."\r\n\r\n

At what time would you like you appointment?:- ".htmlentities($time)."\r\n\r\n

Are you currently a patient at our practice:- ".htmlentities($current)."\r\n\r\n

How did you find us:- ".htmlentities($how_found)."\r\n\r\n";

$sendTo  = '[email protected]';

 

$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";

if($email == ""){

$email = "[email protected]";

$headers  = "MIME-Version: 1.0\r\n";

}

$headers .= "From: ".htmlentities($name)." <".htmlentities($email).">\r\n";

mail($sendTo, "Contact Details", $body, $headers, '[email protected]');

header( "Location:f_cen.php?msg=1");

exit;

}

else{

header( "Location:f_cen.php?msg=2");

exit;

}

}

 

?>

 

Later, in the <body> there is this:

 

<?php

if(param("msg") == "1"){

echo "<p><strong>Thank you</strong>, your message has been sent.</p>";

}

if(param("msg") == "2"){

echo "<p class=\"error\">Unfortunately there were no contact details with your message, please try again.</p>";

}

if(param("msg") != "1"){

?>

 

and this:

 

<?php

}

?>

 

then after the </html> closing tag there is this:

 

<?php

function getPost($name){

$r="";

if(array_key_exists($name, $_POST)){

if(get_magic_quotes_gpc() == 1){

$r = stripslashes($_POST[$name]);

}

else{

$r = $_POST[$name];

}

}

return(trim($r));

}

function param($name){

$r="";

if(array_key_exists($name, $_REQUEST)){

if(get_magic_quotes_gpc() == 1){

$r = stripslashes($_REQUEST[$name]);

}

else{

$r = $_REQUEST[$name];

}

}

return(trim($r));

}

?>

 

the working version can be seen here:

 

http://www.indesignonline.co.uk/duke_street/f_cen.php

 

Help me please!

 

Tony B

Link to comment
https://forums.phpfreaks.com/topic/201522-is-my-problem-in-the-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.