PHP feedback form help - newb

P

Paul Gunson

i've got a very basic feedback form working thanks to an online
tutorial, using sendmail.php.

my sendmail.php below basically sends a form of two selection boxes and
a textarea for additional comments. it sends me mail ok but the order of
the information as it appears in the e-mail seems to be random... eg,
how do i get select1 to appear first, then select 2, then a line break
and the textbox last...? the current layout makes select2 appear first,
then the textbox, line break, and select1 last. i've tried other layouts
but they either don't send the textbox or result in an error....

<?
$select1 = $_REQUEST['select1'];
$select2 = $_REQUEST['select2'];
$textbox = $_REQUEST['textbox'];

mail( "(e-mail address removed)", "Online survey",
"$textbox\n Site looks: $select1", "Connection speed: $select2" );
header( "Location: /thankyou.html" );
?>

any help for an html ignoramus greatly apprec.
 
P

Paul Furman

Paul said:
i've got a very basic feedback form working thanks to an online
tutorial, using sendmail.php.

my sendmail.php below basically sends a form of two selection boxes and
a textarea for additional comments. it sends me mail ok but the order of
the information as it appears in the e-mail seems to be random... eg,
how do i get select1 to appear first, then select 2, then a line break
and the textbox last...? the current layout makes select2 appear first,
then the textbox, line break, and select1 last. i've tried other layouts
but they either don't send the textbox or result in an error....

<?
$select1 = $_REQUEST['select1'];
$select2 = $_REQUEST['select2'];
$textbox = $_REQUEST['textbox'];

mail( "(e-mail address removed)", "Online survey",
"$textbox\n Site looks: $select1", "Connection speed: $select2" );
header( "Location: /thankyou.html" );
?>



Here's your mail statement (more readable):

mail(
"(e-mail address removed)",
"Online survey",
"$textbox\n Site looks: $select1",
"Connection speed: $select2" );


You want to compose the message body with the three variables so first
do this:
$message-body =
."Site looks: ".$select1
."\nConnection speed: ".$select2
."\n".$textbox;

The dot is a string concatenator, variables don't need to be quoted,
notice the commas below and semicolon at the end of each statement. I
think the newline "\n" is a string.


Then, I think the format is:
mail(
"(e-mail address removed)",
$subject,
$message-body);

If you have errors, you can do:
$mailerror = mail(as shown above)
then:
echo $mailerror
to debug it.


The manual in this case is not very helpful, it's usually much much more
clear. If you scroll down, there are good examples though.
http://us2.php.net/manual/en/ref.mail.php
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top