Forum Moderators: coopster

Message Too Old, No Replies

php form to email

php form

         

ictglobal

1:02 am on Feb 28, 2004 (gmt 0)

10+ Year Member



I have a php form that signs up people to a flat file database. The sign up works fine.

Here is the form:
<form>
<input type="text" name="Name" size="20">
<input type="text" name="Email" size="20">
<input type="submit" value="Submit" name="submit">
</form>

I want to insert a mail function so that the Name and Email will be sent to my email address.

This is the flow I want.

1. A user fills the form to sign up.
2. As the sign up page confirms his registration, I will receive an email in my box with the persons name and email address.

This is my attempt so far.

<?php
$to = "someemailatsomeemaildotcom" ;
$subject = "New Registration" ;
$msg = "$Name",$Email" ;
mail($to, $subject, $msg) ;?>

I received the email alright but without the values for "Name" and "Email".

Can someone put me right.

Also how can I send a blind carbon copy in php mail, in this case.

IanKelley

8:56 am on Feb 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



> $msg = "$Name",$Email" ;

Missing a quote and the comma is a syntax error.

Use this:

$msg = $_POST['Name']."\n".$_POST['Email'];

Timotheos

5:45 pm on Feb 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also how can I send a blind carbon copy in php mail

$headers = "Bcc: me@example.com\r\n";

mail($to, $subject, $msg, $headers)