Here's the code I'm using with the exception of the php tags and the
redirect script that redirects to another page once the form is
submitted. This is just a test script I'm working on in order to teach
myself php. The php portion will be posted first, than the html form
related to the php. I've got the code inside tags similar to the "code"
tag which only serves to serarate the php code from the html form.
[php_code]
$name = $_POST['firstname'] . ' ' . $_POST['lastname'];
$email = $_POST['email'];
if($_POST['reallife'] == "on")
{
$to = 'Ben@xxxxxxxxxxxx';
$subject ='test email one';
$msg = "$name has filled out the test form. \n" .
"this is just a test message";
mail ($to, $subject, $msg, 'From:' . $email);
} else {
$to = 'Ben@xxxxxxxxxxxx';
$subject ='test email two';
$msg = "$name has filled out the test form." ;
mail ($to, $subject, $msg, 'From:' . $email);
}
if($_POST['reallife'] == "on") {
$to = '$email';
$subject = "Thank you email number one";
$msg = "hello $name, \n" .
"thank you for filling out the form. \n" .
"This is the first of two test emails \n" .
"The second would have been sent \n" .
"if you had left the checkbox unchecked \n";
mail ($to, $subject, $msg, 'From:' . $Ben@xxxxxxxxxxxx);
}
header ("location:thankyoupage")
[/php_code]
[html_code]
<div align="center">
<table border="0"
cellpadding="3" cellspacing="0" width="59%">
<tr>
<td colspan="2">
<h2 align="center"> </h2>
<h2 align="center"><font color="blue" face="Arial">Contact Form</font></h2>
<p align="center"> </p>
<td width="51%" align="right">
<p align="left"><font face="Arial">Email</font><font face="Times New
Roman">:</font><font face="Arial"> </font></td>
<td width="49%" align="left"><input type="text" name="email" size="20"></td>
</tr>
<tr>
<td width="51%" align="right">
<p align="left"><font face="Arial">First Name: </font></td>
<td width="49%" align="left"><input type="text" name="firstname"
size="20"></td>
</tr>
<tr>
<td width="51%" align="right">
<p align="left"><font face="Arial">Last Name: </font></td>
<td width="49%" align="left"><input type="text" name="lastname"
size="20"></td>
</tr>
<tr>
<td width="51%" align="right">
<p align="left"><font face="Arial">I know you in real life</font></td>
<td width="49%" align="left"><input type="checkbox" name="reallife"
size="20"></td>
</tr>
</table>
<p><input type="submit" value="contact me"
name="B1"></p>
</center></div>
</form>
</td>
<td> </td>
</tr>
</table>
[/html_code]
This actual code that is on the portion of my hosting account which I
use as my test server. In my opinion, it's much cheaper to pay for a
hosting account to use as a test server to teach myself php than it is
to pay some collage professor to teach it to you only to be slapped in
the face by having him assume you're learning php to be a freelance
coder working for a company that does freelance work. The truth is, I
only have an interest in learning php to use in my own business and when
I get good enough, I may do some freelancing on the side on sites like
Scriptlance, but my main focus will be my own business and for anyone to
have the audacity that I plan on working for someone else my whole life
pisses me off, so that's why I'd much rather teach myself than to take a
college class on php.
Thanks,
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php