[thelist] php forms to email
Liam Delahunty
ldelahunty at britstream.com
Tue Sep 17 16:24:01 CDT 2002
Tom Dell'Aringa wrote:
>I've been searching and I am finding a lot of these scripts, but
>since I am new I'm not sure what is good or what I need. Some seem
>awfully feature full, but all I need it to take like 4 fields and
>send them via email when the form is submitted, and send a copy to
>the person if they want it (if a checkbox is clicked.) Can someone
>point me to a script they use for this, or a good resource?
I just cut 'n' pasted this from a fairly hefty script, so apologies if I
missed something vital...
<?php
if ($submit){
reset($HTTP_POST_VARS);
while (list($key,$val) = each($HTTP_POST_VARS)){
$message .= "$key: $val\n";
// want to see it?
print ("$key: $val<br>");
}
$email_headers = "From: $email\n";
$email_subject = "$main_path " . $PHP_SELF . " form";
@mail($your_email_addr, $email_subject, $message, $email_headers);
if ($i_want_a_copy){
@mail($email, $email_subject, $message, $email_headers);
}
}
print ("<form action=\"$PHP_SELF\" method=\"POST\">");
print ("<table>\n");
print ("<tr><td>Email: </td><td><input type=\"Text\" name=\"email\"
value=\"$email\"></td></tr>\n");
print ("<tr><td>How did hear about us?</td><td><input type=\"Text\"
name=\"hear_about_us\" value=\"$hear_about_us\"></td></tr>\n");
print ("<tr><td>Would you like to receive a copy of the
email?</td><td><input type=\"Checkbox\" name=\"i_want_a_copy\"
checked></td></tr>\n");
print ("<tr><td> </td><td><input name=\"submit\" type=\"Submit\"
value=\"Send\"></td></tr>\n");
print ("</table>");
print ("</form>");
?>
Kind regards,
Liam Delahunty
--
### ADVERT ###
Coming soon! Get the latest Roddy Frame (Aztec Camera) album on vinyl here:
http://www.biggerbrighterbetter.com/
More information about the thelist
mailing list