473,396 Members | 1,683 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,396 software developers and data experts.

New to PHP and have some is issues with PHP email form I am setting up

I am new to PHP and setting an email form. I have this form working now with the exceptions. First I want a copy of the message email back to the sender. What is the PHP code for this? Second with the Phone Number field the senders phone number is just coming back blank.

This is my code:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if ($_POST['parse_var'] == "contactform") {
  3.  
  4.     $emailTitle = 'New email from your Website!';
  5.     $yourEmail = 'email@email.com, email2@email2.net';
  6.     $CCUser = $_POST['email'];
  7.  
  8.     $subjectField = $_POST ['subject'];
  9.     $emailField = $_POST ['email'];
  10.     $nameField = $_POST ['name'];
  11.     $addressField = $_POST ['address'];
  12.     $cityField = $_POST ['city'];
  13.     $stateField = $_POST ['state'];
  14.     $zipcodeField = $_POST ['zipcode'];
  15.     $phoneNumberField = $_POST ['phoneNumber'];
  16.     $messageField = $_POST ['message'];
  17.  
  18.     $body = <<<EOD
  19. <br><hr><br>
  20.     subject: $subjectField <br />
  21.     Email: $emailField <br />
  22.     Name: $nameField <br />
  23.     Address; $addressField <br />
  24.     City: $cityField <br />
  25.     State: $stateField <br />
  26.     Zipcode: $zipcodeField <br />
  27.     Phone Number: $phoneNumberField <br />
  28.     Message: $messageField <br />
  29.  
  30. EOD;
  31.  
  32.     $headers = "From: $emailField\r\n";
  33.     $headers .= "Content-type: text/html\r\n";
  34.     $success = mail("$yourEmail","$emailTitle","$body","$headers");
  35.  
  36.     $sent = "Thank You! Your message has been successfully sent.
  37.     <br /><br />";
  38.  
  39. }
  40. ?>
This is the email I am getting

subject: Test
Email: email@email.com
Name: Kenny
Address; 201
City: CC
State: TX
Zipcode: 78410
Phone Number:
Message: Phone Test
Sep 11 '13 #1
2 1339
ariful alam
185 100+
hello,
you need two solutions.
1. sending the mail back to the mail sender.
ans:
You have the following line
Expand|Select|Wrap|Line Numbers
  1. $yourEmail = 'email@example.com, email2@example.org';
just make it...
Expand|Select|Wrap|Line Numbers
  1. $yourEmail = 'email@example.com, email2@example.org, ' . $_POST ['email'];
2. phone number not showing the value:
ans, check the field that for phone number, settings
or add here the full html page that has the form
Sep 11 '13 #2
Dormilich
8,658 Expert Mod 8TB
additionally, check with var_dump($_POST); what data you actually posted.
Sep 12 '13 #3

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

Similar topics

2
by: john | last post by:
if I have if (document.form.element.type == "select") and I have a form with at liest 1 element on the page this should work right? I keep getting a "document.form.0 is null or not an object"...
2
by: alwaysintune | last post by:
I'm using the McFedries email form, and I can't seem to get an upload form to work. Instead of it saving to my server, I want it to send the information and the picture to my email. Here is the...
8
by: alice | last post by:
I found this code for making a php email form for a web site. It works fine on my ISP, but not on my friends...could it be that my ISP uses php5, I know that hers does not, so I assume it's php4....
23
by: karen987 | last post by:
I have a form on a html page which one fills in and submits using email. The form has been opened in a pop up page, Once the form has been submitted, (emailed) I need to add some javasript...
3
by: missred | last post by:
Hi All, I'm hoping someone can help me with this problem. the form works ok in firefox and IE6, but when send is pressed, a blank email form or a blank IE7 page comes up, instead of the message...
3
by: pete.brooker | last post by:
Hi, Being new to PHP & cookies, I am looking to write an email form, where a user can choose their name from a drop down list, fill in the content of the email and hit send and the email will be...
10
by: newbie172 | last post by:
I have an email form that does not work...can somebody tell me what I am doing wrong? I can make it work if the send button is not an image. I've first included the code for the form and then...
3
by: caltucker | last post by:
I have an email form for an organization with an apostrophe in their title: LA's BEST. Their name is part of the standard email greeting. For example, Hello from LA's BEST. My problem is that...
1
by: budyerr | last post by:
All, I am trying to build a email submission form using asp.net. I currently have a web form page that will upload to my webhosting server, attach to email then delete the file after sending. ...
3
by: jennifer6601 | last post by:
Hello. I am new to this forum as well as to ASP and need some help with a simple email form for a website I've developed. I have a simple html email form that is processed with an ASP script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.