Jump to content

basic mailing


NickG21

Recommended Posts

hey everyone, i am trying to write a small validation script of some information on a single form page and at the end of the validation if everything is correct mail ALL of the entered information to myself.  my quick mail statement looks like this:
[CODE] mail('ngirard@....com',$subject, $problem,"From: $name <$email>");[/CODE]
but i am unable to send the other variables that are passed from the form into the session because there are only 8 parameters allowed in mail();.  i am new to this as you can probably tell and was wondering if i could take the other 5 or 6 variables i pass into validation and make them be the body of the mail?
any help is appreciated
Link to comment
Share on other sites

Yes, you just need to include them in the body, like this:

[code]<?php
// Here's the values from my form
$fav_colour = $_POST['colour'];
$fav_food = $_POST['food'];
$fav_animal = $_POST['animal'];

// Here's the to and subject fields
$to = "myemail@mydomain.com";
$subject = "My Test Email";

// Here's the values from my form all combined into one message variable
$msg .= "My favourite colour is $fav_colour\n";
$msg .= "My favourite food is $fav_food\n";
$msg .= "My favourite animal is $fav_animal\n";

// Send the message
mail($to, $subject, $msg);
?>[/code]

Regards
Huggie
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.