awebb
09-10-2003, 10:38 AM
I have a function that should mail me the contents of a form when triggered by onSubmit"".
The mail arrives (twice actually) but is empty ie only the subject titles are shown.
Is the function in the wrong place or am I calling it wrong?
Heres the code above the head and just underneath the code I am using for onSubmit"".
<?php
function sendMailInfo()
{
/* emailing info, first set variables*/
$title=$HTTP_POST_VARS['title'];
$fname=$HTTP_POST_VARS['firstname'];
$lname=$HTTP_POST_VARS['lastname'];
$address1=$HTTP_POST_VARS['address1'];
$address2=$HTTP_POST_VARS['address2'];
$towncity=$HTTP_POST_VARS['towncity'];
$postcode=$HTTP_POST_VARS['postcode'];
$country=$HTTP_POST_VARS['country'];
$telephone=$HTTP_POST_VARS['telephone'];
$email=$HTTP_POST_VARS['email'];
$startdate1=$HTTP_POST_VARS['startdate1'];
$startdate2=$HTTP_POST_VARS['startdate2'];
$startdate3=$HTTP_POST_VARS['startdate3'];
$startdate4=$HTTP_POST_VARS['startdate4'];
$adults=$HTTP_POST_VARS['adults'];
$children=$HTTP_POST_VARS['children'];
$catering=$HTTP_POST_VARS['catering'];
$comments=$HTTP_POST_VARS['comments'];
$to="webmaster@chinchall.com, admin@chinchall.com";
$subject="Clouseau Booking";
/* The body text */
$content= "Name: ".$title." ".$fname." ".$lname."\r\n"
."Address: ".$address1." ".$address2."\r\n"
."Address: ".$towncity." ".$postcode." ".$country."\r\n"
."Telephone: ".$telephone."\r\n"
."email: ".$email."\r\n"
."Week1: ".$startdate1."\r\n"
."Week2: ".$startdate2."\r\n"
."Week3: ".$startdate3."\r\n"
."Week4: ".$startdate4."\r\n"
."Adults: ".$adults."\r\n"
."Children: ".$children."\r\n"
."Catering: ".$catering."\r\n"
."Comments: ".$comments."\r\n";
/* send the info */
mail ($to, $subject, $content);
}
and I am calling it in the form with:
onSubmit"<?php sendMailInfo();?>"
Any suggestion gratefully recieved.
Andy
The mail arrives (twice actually) but is empty ie only the subject titles are shown.
Is the function in the wrong place or am I calling it wrong?
Heres the code above the head and just underneath the code I am using for onSubmit"".
<?php
function sendMailInfo()
{
/* emailing info, first set variables*/
$title=$HTTP_POST_VARS['title'];
$fname=$HTTP_POST_VARS['firstname'];
$lname=$HTTP_POST_VARS['lastname'];
$address1=$HTTP_POST_VARS['address1'];
$address2=$HTTP_POST_VARS['address2'];
$towncity=$HTTP_POST_VARS['towncity'];
$postcode=$HTTP_POST_VARS['postcode'];
$country=$HTTP_POST_VARS['country'];
$telephone=$HTTP_POST_VARS['telephone'];
$email=$HTTP_POST_VARS['email'];
$startdate1=$HTTP_POST_VARS['startdate1'];
$startdate2=$HTTP_POST_VARS['startdate2'];
$startdate3=$HTTP_POST_VARS['startdate3'];
$startdate4=$HTTP_POST_VARS['startdate4'];
$adults=$HTTP_POST_VARS['adults'];
$children=$HTTP_POST_VARS['children'];
$catering=$HTTP_POST_VARS['catering'];
$comments=$HTTP_POST_VARS['comments'];
$to="webmaster@chinchall.com, admin@chinchall.com";
$subject="Clouseau Booking";
/* The body text */
$content= "Name: ".$title." ".$fname." ".$lname."\r\n"
."Address: ".$address1." ".$address2."\r\n"
."Address: ".$towncity." ".$postcode." ".$country."\r\n"
."Telephone: ".$telephone."\r\n"
."email: ".$email."\r\n"
."Week1: ".$startdate1."\r\n"
."Week2: ".$startdate2."\r\n"
."Week3: ".$startdate3."\r\n"
."Week4: ".$startdate4."\r\n"
."Adults: ".$adults."\r\n"
."Children: ".$children."\r\n"
."Catering: ".$catering."\r\n"
."Comments: ".$comments."\r\n";
/* send the info */
mail ($to, $subject, $content);
}
and I am calling it in the form with:
onSubmit"<?php sendMailInfo();?>"
Any suggestion gratefully recieved.
Andy