473,322 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

PHP Form Mailer

nomad
664 Expert 512MB
Hello Everyone:

This is an contact form

I thought I solved the problem.
What I need to is have the sender email address posted on the email ie the headers of an email
Right not the headers say
Info
it use to have some numbers 1439581.1546653 which are related to the hosting site.
Hope that made sense.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. if(isset($_POST['email'])) {
  4.  
  5.     // EDIT THE 2 LINES BELOW AS REQUIRED
  6.     $email_to = "info@abc.com" ;
  7.     $headers= "From: .$email";
  8.     $email_subject = "Web Support Inquiry";
  9.  
  10.  
  11.      // function died($error) {
  12.         // your error code can go here
  13.      //   echo "We are very sorry, but there were error(s) found with the form you submitted. ";
  14.      //   echo "These errors appear below.<br /><br />";
  15.      //   echo $error."<br /><br />";
  16.      //   echo "Please go back and fix these errors.<br /><br />";
  17.      //   die();
  18.   //  }
  19.  
  20.     // validation expected data exists
  21.     if(!isset($_POST['comments']) ||
  22.         !isset($_POST['Your_name']) ||
  23.         !isset($_POST['email'])) //{
  24.         died('We are sorry, but there appears to be a problem with the form you submitted.');      
  25.    // }
  26.  
  27.     $comments = $_POST['comments']; // required
  28.     $Your_name = $_POST['Your_name']; // required
  29.     $email = $_POST['email']; // required
  30.  
  31.  
  32.    // $error_message = "";
  33.   //  $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  34. //  if(!preg_match($email_exp,$email_from)) {
  35.  //   $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  36.  // }
  37.  //   $string_exp = "/^[A-Za-z .'-]+$/";
  38.  // if(!preg_match($string_exp,$first_name)) {
  39.  //   $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  40.  // }
  41.   //if(!preg_match($string_exp,$company)) {
  42.  //   $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  43. //  }
  44. //  if(strlen($error_message) > 0) {
  45.  //   died($error_message);
  46. //  }
  47.  
  48. //email body information   
  49.  
  50.     $email_message = "Web Support Inquir.\n\n";
  51.     function clean_string($string) {
  52.       $bad = array("content-type","bcc:","to:","cc:","href");
  53.       return str_replace($bad,"",$string);
  54.     }
  55.     $email_message .= "Comments:    ".clean_string($comments)."\n";
  56.     $email_message .= "Name:    ".clean_string($Your_name)."\n";
  57.     $email_message .= "Email:      ".clean_string($email)."\n";
  58.  
  59.  
  60. // create email headers
  61.  
  62. $headers = 'From: '.$email."\r\n".
  63.  
  64. 'Reply-To: '.$email_to."\r\n" .
  65. 'X-Mailer: PHP/' . phpversion();
  66.  
  67. @mail($email_to, $email_subject, $email_message, $headers ); 
  68.   header( 'Location: http://www.abc.com/thankyou.html' ) ;
  69. ?>
  70.  
  71. <!-- include your own success html here -->
  72.  
  73. <?php
  74. }
  75. ?>
  76.  
Thanks
Damon
Feb 21 '14 #1
1 1469
nomad
664 Expert 512MB
I figured it out, had to deal with the header.

Line 7 $headers= "From: .$Your_name";
Line 62 $headers = 'From: '.$Your_name."\r\n".
Feb 24 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ciberguy | last post by:
I created a form that collects information from a user via a web page. The form appears to work well - it won't let you submit the form until required data is place in the required fields. I...
0
by: Sparky Arbuckle | last post by:
I've tried the two following Send_Email sub routines on Brinkster. No luck getting either to work. Could someone that has experience with Brinkster please let me know what is going on? I've gotten...
0
by: Ken | last post by:
We have a shared hosting plan (Windows-based) with GoDaddy.com. GD.com has a "generic" form mailer script (gdform.asp) that allows us to set up a "Contact Us" page, which, when the user clicks...
1
by: javascript | last post by:
I need to modify a code in Java Script for a Form Mailer page (asp), to be used for online newsletter subscriptions. So long, CDONTS had been playing an important role here, but since SMTP...
8
by: M.L. | last post by:
Hello. I created a form using JS validation with the form tag as follows: <form name="form1" action="dynaform.php" method="post" onsubmit="return pvg_sub();"> The js validation script sends...
2
by: carringtonf | last post by:
Okay, I have a form up that worked fine until recently. My hosting (1&1) is denying that they did anything, and that they can't assist me. So I turn to you. Form location -...
18
by: txguy | last post by:
Hello and thanks. have a html form with 1210 checkboxes that define item description, number and price. would like to find a PHP script that reads these values when the checkbox is checked and then...
10
by: Michael117 | last post by:
Hey guys, I'm pretty new here and I need some help. What I want to do is very easy. I have a webpage (<Link removed>) that has a form on it and I want the information that is submitted on the...
3
by: washed | last post by:
Here's my question... Much thanks if you can help... I have a form page with a ASP:imagebutton that calls a (VB sub click event) to calculate user input and displays the results on the page (that...
4
by: luke noob | last post by:
This is my HTML... <head> <script type="text/javascript" src="js/jquery-1.2.6.pack.js"></script> <script type="text/javascript" src="js/script.js"></script> </head> <body>
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.