473,396 Members | 1,809 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.

php script for mail form - question -

Hi I got the following script going;

<?php
$sendTo = "my*****@myemail.com";
$subject = "My web site reply";

$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];
mail($sendTo, $subject, $message, $headers);
?>

It's simple and save and I'm not really into php (yet!)...
However I have a question regarding my script.
In the Email body/message I receive after the form is filled in and
submited
I only see the message - obvousily because of this line $message =
$_POST["message"]; -
Now I would like to receive to name and email address in mail
body/message to.
How do I go about to achieve this, I've tried the following...

$message = $_POST["name"];
$message = $_POST["email"];

after I added the above two lines it didn't result in anything.
Anyone wanna fill me in on how I can put this to work.
Thank, appreciate it!

Dec 8 '05 #1
1 1422
cartoonsmart wrote:
Hi I got the following script going;

<?php
$sendTo = "my*****@myemail.com";
$subject = "My web site reply";

$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];
mail($sendTo, $subject, $message, $headers);
?>

It's simple and save and I'm not really into php (yet!)...
However I have a question regarding my script.
In the Email body/message I receive after the form is filled in and
submited
I only see the message - obvousily because of this line $message =
$_POST["message"]; -
Now I would like to receive to name and email address in mail
body/message to.
How do I go about to achieve this, I've tried the following...

$message = $_POST["name"];
$message = $_POST["email"];

after I added the above two lines it didn't result in anything.
Anyone wanna fill me in on how I can put this to work.
Thank, appreciate it!
In a word 'concatenation', need to look up concatenation of strings

$myvar = 'I am this';
echo $myvar; //displays 'I am this'

$myvar = 'I am this';
$myvar = ' and I am that';
echo $myvar; //now displays only ' and I am that'

$myvar = 'I am this';
$myvar .= ' and I am that';
echo $myvar; //now displays 'I am this and I am that'
Also your code is just a strip down example, right? You are not really
doing the code exactly like this:
$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";


if so, stop and do a little research on security...

http://www.google.com/search?hl=en&q...=Google+Search
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Dec 8 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DonLi | last post by:
Hello, I tested a PHP script with a FORM of 2 element and it delivered the mail but then when I added more FORM elements, it failed to deliver. Following is the content of the PHP script that...
2
by: Web Master | last post by:
Hi, I am having a little issue with Jacks Form mail php script. I have installed it and configured the form to get it to work, but for some bizarre reason I have 2 issues I can't seem to debug....
6
by: Jeff Dunnett | last post by:
Hello, I have written the following HTML Form: <html><head><title>Survey</title></head> <body bgcolor="black" text="white" link="#f6b580" vlink="#c0c0ff"> <img src="logo.gif" width="324"...
30
by: zn | last post by:
If I place a form for product ordering on my website, what scripting technology or CGIs can I use to encrypt the e-mail sent to my e-mail account with the order information? Thanks.
4
by: Ngoc | last post by:
I created a form, cabreg.asp, with a "Send" button and cdosys_form.asp script. However, I got the message "Page cannot be displayed" Please help and here are my files ---- CABREG.ASP ----- ...
4
by: shror | last post by:
dear all, i have started learning php 2 weeks ago and i have wrote my first script for mail sender and the script takes all my data and move to the thanks page but the problem is that the mails...
20
by: Pete Marsh | last post by:
Wondering if anyone can see an error with this script. I get a server configuration error. THat could mean a module is not being loaded, but maybe there's a syntax error here, can anyone spot it?...
4
by: thanos | last post by:
Hello, I'm relatively new to PHP so I found this free contact us script on the net that i was going to use for my Contact Us php page. Its works pretty good except for error handling. I was...
2
chunk1978
by: chunk1978 | last post by:
i wrote a custom PHP script last year and everything worked perfectly... recently my webserver upgraded to PHP 5 and now my script doesn't work properly. what the script does is: users fill out...
1
by: toretto | last post by:
Hello, I have a script php that I use on my website to permit visitors to send me some email with some data, this is the html table code: <table width="730" border="0" cellpadding="0"...
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?
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
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
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
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
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...

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.