Hi Everyone,

I am very very new at this and I am hoping to get help on a few problems.

I am working on a SQL database that will keep track of Medical Gas Orders for my job.

I created the form and the data is actually going into my database, the problem I ran into is the mail() function. I looked on the net for info on this function and I did find it but I could not understand it since I am just getting into PHP.

This is my problem:

What I want to do is send email to at least 3 different e-mail address as well as the data going into my database. I was told the mail function will do it, but I don't know how to write the script.

Below is what I have so far, but it does not work:

mail("lawfour@verizon.net", "Investigator;: $x_investigator", "From: lawfour@verizon.net\n
Content-Type: text/html; charset=iso-8859-9\nReply-To: lawfour@verizon.net");

Also, the output to the e-mail can that be changed to the original format.


On my form (which i will give the web address to) I have gases that are

C02, 5%02 5%C02 90%N2, 5%C02 95%N2, Investigator and so on, the program I use changed the name of the fields to $x_C02, $x_5_CO22C_5_O22C_90_N2,
$x_5_CO22C_95_N2, $x_investigator

Now I need to change it back into a format that customers and company can read when placing orders.

Any help would be appreciated.

You can find the form and the full source code of the form at http://www.lawfour.com/database/

Also, eventually I would like to have the number of gases ordered displayed on each form which will be another problem I will work on next, what I want to know if I used the right setting to add each feild together. For all fields I am using VCHAR is that right or should I use DECIMAL.

If you go to my form you can see how I have it set up.


12 Years
Discussion Span
Last Post by lwilliam

I thought maybe I would have a answer by now, maybe I am on the wrong message board for this answer. In any case if anyone else was looking for the same answer, here is the code that works for me.

mail("YOUREMAIL@DOMAIN.COM", "SUBJECT", "Field1: $x_field1 \n Field2: $x_field2 \n field3: $x_field3",
"From: YOUREMAIL@{$_SERVER}\r\n" );

For us newbies:

\n = return key (enter) on keyboard

YOURMAIL@DOMAIN.COM = You can add more email address separate by a comma

Field1: = will be displayed in the email form basically the label. you must add (colon) after your label in my case it is Field1:

$x_field1 = this is what contains your input information

From: youremail@{$_SERVER}\r\n = your email address will be displayed in the return section of the email that is sent out. I think this part has tobe explained a little more.

The only thing you have to had in the return is your username, if your email address is john@domain.com then just put From: john@{$_SERVER}\r\n the rest is automatic. Took me awhile to figure that out.

Well, I hope this explains part of the mail() fuction , one more thing, the program I use the above mail function is used under the following code: mysql_close($conn);



This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.