473,398 Members | 2,113 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,398 software developers and data experts.

php send email with variables pulled from POST form

I can't figure out why this page doesn't work. It pulls from a html page that is set to POST when the submit button is clicked but I receive an error saying that the page may be configured incorrectly?
What did I do wrong? I think it may have something to do with putting $_POST in the variables but I don't know for sure.
Expand|Select|Wrap|Line Numbers
  1. Thank you <?php echo $_POST["name"]; ?> for registering for the Office Equipment Smash event!  
  2. </br>You have registered <?php echo $_POST["quantity"]; ?> people for the <?php echo $_POST["reg"]; ?> event(s).
  3. </br>You will be receiving a confirmation email shortly.  
  4. </br></br>If you don't receive the confirmation within 24 hours, please resubmit </br>your registration or send an email to JoeJr@BuffaloPrinting.com.
  5. <?php
  6. $to = "JoeJr@BuffaloPrinting.com";
  7. $subject = "NEW REGISTRATION for Office Equipment Smash!";
  8. $message = "$_POST['name'] Has registered $_POST['quantity'] people for the $_POST['reg'] event(s).  You will be receiving a confirmation email shortly.";
  9. $from = "$_POST['email']";
  10. $headers = "From: . $from";
  11. mail($to,$subject,$message,$headers);
  12. echo "Mail Sent.";
  13. ?>
  14. </body>
  15. </html>
  16.  
Aug 9 '11 #1

✓ answered by johny10151981

at number line:
why do you write this way?
Expand|Select|Wrap|Line Numbers
  1. $from = "$_POST['email']";
  2.  
simply write
Expand|Select|Wrap|Line Numbers
  1. $from = $_POST['email'];
  2.  
And i am not sure which quote works in which one, i dont use it.

i always concat string
your code:
Expand|Select|Wrap|Line Numbers
  1. $message = "$_POST['name'] Has registered $_POST['quantity'] people for the $_POST['reg'] event(s).  You will be receiving a confirmation email shortly.";
my code would be
Expand|Select|Wrap|Line Numbers
  1. $message = $_POST['name']." Has registered ".$_POST['quantity']." people for the ".$_POST['reg']." event(s).  You will be receiving a confirmation email shortly.";
  2.  
and finally make sure all of your post variable exists.

just use print_r function what variable and data you are using.

1 4181
johny10151981
1,059 1GB
at number line:
why do you write this way?
Expand|Select|Wrap|Line Numbers
  1. $from = "$_POST['email']";
  2.  
simply write
Expand|Select|Wrap|Line Numbers
  1. $from = $_POST['email'];
  2.  
And i am not sure which quote works in which one, i dont use it.

i always concat string
your code:
Expand|Select|Wrap|Line Numbers
  1. $message = "$_POST['name'] Has registered $_POST['quantity'] people for the $_POST['reg'] event(s).  You will be receiving a confirmation email shortly.";
my code would be
Expand|Select|Wrap|Line Numbers
  1. $message = $_POST['name']." Has registered ".$_POST['quantity']." people for the ".$_POST['reg']." event(s).  You will be receiving a confirmation email shortly.";
  2.  
and finally make sure all of your post variable exists.

just use print_r function what variable and data you are using.
Aug 9 '11 #2

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

Similar topics

3
by: Robert | last post by:
Hello, Can anyone help with this? On my online order form, I need to send a few variables to my credit-card processor. These variables are for non-secure customer comments, and will be sent...
15
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST....
1
by: mhawkins19 | last post by:
I have a form built and on the onclick event I validate all of the fields and then if the form is ok, on the submit event I run a javascript function to set a cookie and download a file from the...
6
by: havenoclue | last post by:
I have a database application that is submitted to an Access database. What I want is when the form is submitted to automatically send an email to multiple persons with the info from the form. ...
3
by: rob | last post by:
I have an win form app from which I want to be able to send bug reports. My first approach was something like: SmtpClient client = new SmtpClient( ????? ); MailAddress from = new...
0
by: zechdc | last post by:
I have been at this for two weeks now. I am trying to send two variables from a flash file located on newgrounds.com, kongregate.com, armorgames.com or any other site like that to a php file on my...
5
by: canajien | last post by:
I have a form that stores information in a table, but I also need it to send an email when a specific question, among the many, is answered with no the question is a simple drop box: <select...
9
by: paulmitchell507 | last post by:
I have a file called email2.asp which I am using to mail data obtained from a SQL query. I would like to pass the holiday_ID value in the querystring attached to the end of the URL. It all works...
2
by: PrabodhanP | last post by:
I want to send form data to email using ASP (post method). I am trying following script but it's not working.Please suggest. Also suggest how to redirect it after pressing submit button. <% Dim...
4
by: dfluker | last post by:
This form will not send the email to my account and I used other forms to submit emails using examples that I googled but I can't get this form to process the request. Can someone tell me what i'm...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.