View Single Post
Old 07-05-2006   #12 (permalink)
GoldNetX
Recursively call who?
 
GoldNetX's Avatar
 
Join Date: Nov 2003
Location: Pittsburgh, PA
Posts: 294

Send a message via AIM to GoldNetX
Yeah there are two ways of going about it, as Telos showed. You could just copy and paste the php code at the top of your page (just for ease of reading).

Code:
<?php

if ($_POST['emailSubmit']){
     $body = "The following information was just submitted by a user: \n\n Full Name: " . $_POST['name'] . "\n Address: " . $_POST['address'] . "\n City: " . $_POST['city'] . "\n State: " . $_POST['state'] . "\n Age: " . $_POST['age'] . "\n Comment: " . $_POST['comment'];
     mail($_POST['emailTo'], "Replace this with what you want the subject to be", $body);
}

?>

<!DOCTYPE ... rest of your code ...
Or you could do it so that the page will show the form, but once it is submitted it will send the email and display a thank you message instead of the form. This code piece would do it:

Code:
<?php

if ($_POST['emailSubmit']){
     $body = "The following information was just submitted by a user: \n\n Full Name: " . $_POST['name'] . "\n Address: " . $_POST['address'] . "\n City: " . $_POST['city'] . "\n State: " . $_POST['state'] . "\n Age: " . $_POST['age'] . "\n Comment: " . $_POST['comment'];
     mail($_POST['emailTo'], "Replace this with what you want the subject to be", $body);

echo "Thank you, and email has been sent out with your information.";

}else{ // Allow the HTML form to be displayed

?>

<form method="POST" action="<?php echo $_SERVER['PHPSELF']; ?>" >
<input type="hidden" name="emailTo" value="mst0ke@yahoo.com" />

  <p>&nbsp;</p>
<div id="title">CLASS SIGN UP </div>
<div class="row">
  <label class="col1">Full Name:&nbsp;&nbsp;</label>
<span class="col2"><input name="name" class="input" type="text" id="name" size="20" tabindex="1"  /></span>

</div>
<div class="row">
  <label class="col1">Address:&nbsp;&nbsp;</label>
  <span class="col2">
  <input name="address" class="input" type="text" id="address" size="25" tabindex="2" />
</span>
</div>
<div class="row"><label class="col1">City:&nbsp;&nbsp;</label>
<span class="col2"><input name="city" class="input" type="text" id="city" value="" size="2" tabindex="3" /></span>
</div>
<div class="row"><label class="col1">State:&nbsp;&nbsp;</label>
<span class="col2"><input name="state" class="input" type="text" id="state" value="" size="9" tabindex="4" /></span>
</div>
<div class="row"><label class="col1">Age:&nbsp;&nbsp;</label>
<span class="col2"><input name="age" class="input" type="text" id="age" value="" size="3" tabindex="5" /></span>
</div>
<div class="row"></div>

<div class="row"><label class="col1comment">Comment:&nbsp;&nbsp;</label>
<span class="col2comment"><textarea cols="20" class="textarea" rows="4" name="comment" id="comment" tabindex="6" ></textarea></span>
</div>
<div align="center" class="submit">
  <input type="submit" name="emailSubmit" value="Submit" />
  </form>
</div>

<?php } ?>
__________________

www.gusmayo.com
- Maybe a story or two -


www.jaloobie.com
... your new home ...

www.webinkproductions.com
- professional web application design -
GoldNetX is offline