form fields in html are fname, lname, email and contact
I tell the form to look to my server for a script called contact.php
but it only seems to add the first field. My eyes glaze over when the
tutorials start talking about arrays etc :)
Thanks in advance
Kinda hard to tell what's wrong, when you haven't posted either the html or
the php files....
oops :)
its a very basic contact.php file
<?php
$fname = $_REQUEST['fname'] ;
$lname = $_REQUEST['lname'] ;
$email = $_REQUEST['email'] ;
$cont = $_REQUEST['cnum'] ;
mail( "m...@mydomain.com", "Feedback Form Results", "From: $email",
$fname, $lname, $cnum);
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>
That says this afterwards. I'll work on getting data into a file
later but for now I can't even get it to email itself to me :(
Again, many thanks
Warning: mail() expects at most 5 parameters, 6 given in /home/
pressco1/public_html/popopweightloss.com/contact.php on line 8
We encountered an error sending your mail
This doesn't do any checking of parameters. Malicious spambots will
love to abuse this.
Why do you think that mail() has six arguments, and what does the sixth
one mean?
>if($sent)
Where did you set the value of $sent?
>{print "Your mail was sent successfully"; }
>else
>{print "We encountered an error sending your mail"; }
>?>
>That says this afterwards. I'll work on getting data into a file
>later but for now I can't even get it to email itself to me :(
>
>Again, many thanks
>
>
>Warning: mail() expects at most 5 parameters, 6 given in /home/
>pressco1/public_html/popopweightloss.com/contact.php on line 8
The above is a really strong hint that something is wrong.
Read it.
> its a very basic contact.php file
I'd like to suggest you study this page, then use the template for your
own page. Expand as necessary, but don't change how it works.
http://safalra.com/programming/php/contact-feedback-form/
--
-bts
-Four wheels carry the body; two wheels move the soul
I presume these variables do contain data and you have checked that.
> mail( "m...@mydomain.com", "Feedback Form Results", "From: $email",
> $fname, $lname, $cnum);
>
$cnum above should have been $cont. I take it that's a misprint.
I'm no expert, but if you are using the php mail command then it
generally contains 4 parts:
mail(customer email address, subject, message body, header info)
You have the customer email address and the subject, but you have no
body, instead you have the from part which should be included as part of
the header info. Then you have 3 other variables that you have decided
to include for some reason.
So create your $body text and put that as the 3rd part and then work on
the $header part which should contain your 'From' name and email
address,
Something along the lines of:
$header = "From: your name <your email address>\r\n"
So you'll end up with something like:
mail( "m...@mydomain.com", "Feedback Form Results", $body, $header);
Having said that you could try putting php mail into google. You're sure
to get plenty of help. Or goto:
http://www.php.net/manual/en/function.mail.php
--
Pete Ives
Remove All_stRESS before sending me an email