Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

 in mail

the mail() function

Moderators: macek, egami, gesf

 in mail

Postby chrisboots » Mon Feb 10, 2014 4:26 am

Hi all


using the mail function on my works website, it gets the info from a form and mails it to us but instead of getting £(price) we get £(price).


my boss is being fussy and wants the  gone. please can someone help me figure this out, code below

Code: Select all
<?php
if(isset($_POST['email'])) {
     
    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "bookings@pennycarhire.co.uk";
    $email_subject = "Returning Customer Booking Request";
    $thankyou = "thankyou.html"; // thank you page
   $headers = 'Content-Type: text/html; charset=utf-8';
     
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }
     
    // validation expected data exists
    if(!isset($_POST['colect2']) ||
        !isset($_POST['coltime2']) ||
        !isset($_POST['email']) ||
        !isset($_POST['retur2']) ||
        !isset($_POST['rettime2'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');       
    }
   
   
     
    $colect = $_POST['colect2']; // required
    $ctime = $_POST['coltime2']; // required
    $email_from = $_POST['email']; // required
    $return = $_POST['retur2']; // not required
    $rtime = $_POST['rettime2']; // required
   $car = $_POST['cartype']; // required
   $days = $_POST['days2']; // required
   $price = $_POST['price2']; // required
   $waiv = $_POST['wavco']; // required
   $toprice = $_POST['tocost']; // required
   $name = $_POST['name']; // required
   $dd = $_POST['DD']; // required
   $mm = $_POST['MM']; // required
   $yy = $_POST['YY']; // required
   $liheld = $_POST['liheld']; // required
   $lipart = $_POST['lipart']; // required
   $claim = $_POST['claim']; // required
   $phone1 = $_POST['phone1']; // required
   $qorc = $_POST['qorc'];
   
     
    $error_message = "";
 
   
  if(strlen($rtime) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
   
   

    {$email_message .= "Name: ".clean_string($name)."\n\n";
   
    $email_message .= "Car Type: ".clean_string($car)."\n\n";
   
    $email_message .= "Collect on: ".clean_string($colect)."\n\n";
   
   $email_message .= "At: ".clean_string($ctime)."\n\n";
   
   $email_message .= "Return on: ".clean_string($return)."\n\n";
   
    $email_message .= "At: ".clean_string($rtime)."\n\n";
   
   
   
   $email_message .= "Days: ".clean_string($days)."\n\n";
   
   $email_message .= "Inclusive Price: ".clean_string($price)."\n\n";
   
   $email_message .= "Waiver Ammount (If Blank No Waiver): ".clean_string($waiv)."\n\n";
   
   $email_message .= "Total Cost: ".clean_string($toprice)."\n\n";
   
   $email_message .= "Email: ".clean_string($email_from)."\n\n";
   
   
   
    $email_message .= "Dob: ".clean_string($dd)."/".clean_string($mm)."/".clean_string($yy)."\n\n";
   
   $email_message .= "Contact Number: ".clean_string($phone1)."\n\n";
   
   $email_message .= "Bring both parts of licence (if no they have aggreed £3 charge): ".clean_string($lipart). "\n\n";
   
   $email_message .= "Claims Or Accidents: ".clean_string($claim)."\n\n";
   
   $email_message .= "Questions/Comments: ".clean_string($qorc)."\n\n";
   
   }
   
   
   
   
 
   
   
     
     
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); 
?>
 
<!-- include your own success html here -->
 
<script>location.replace('<?php echo $thankyou;?>')</script>
 
<?php
}
?>
chrisboots
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Feb 10, 2014 4:23 am

Return to PHP coding => Mail

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.