screaming_banjo
09-30-2003, 04:13 AM
Firstly I have no knowledge of PHP, however pyro pointed me in the direction of this piece of code (for which I am grateful!)
I have attempted to test it prior to putting it on the page I'm working on (a questionnaire), however I'm not really sure what it should be doing. Here's what I've got:
<?PHP
#######################################################
# This script is Copyright 2003, Infinity Web Design #
# Distributed by http://www.webdevfaqs.com #
# Written by Ryan Brill - ryan@infinitypages.com #
# All Rights Reserved - Do not remove this notice #
#######################################################
## The lines below need to be edited...
###################### Set up the following variables ######################
#
$to = "mandypen_99@yahoo.com"; #set address to send form to
$subject = "Results from your Request Info form"; #set the subject line
$headers = "From: Form Mailer"; #set the from address, or any other headers
$forward = 0; # redirect? 1 : yes || 0 : no
$location = "thankyou.htm"; #set page to redirect to, if 1 is above
#
##################### No need to edit below this line ######################
## set up the time ##
$date = date ("l, F jS, Y");
$time = date ("h:i A");
## mail the message ##
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}
?>
All I've done is change the line in the $to field to an email address (and create a page called "thankyou.htm"). When I click on the submit button, a download dialogue box appears - I thought this seemed odd! I accepted the download, but nothing was emailed to the email address.
I'm sorry for my vagueness, I really have no idea what I'm doing here as I only have experience of HTML and have been advised via that forum that this script would be the best way of processing the form,
thanks for any help!
I have attempted to test it prior to putting it on the page I'm working on (a questionnaire), however I'm not really sure what it should be doing. Here's what I've got:
<?PHP
#######################################################
# This script is Copyright 2003, Infinity Web Design #
# Distributed by http://www.webdevfaqs.com #
# Written by Ryan Brill - ryan@infinitypages.com #
# All Rights Reserved - Do not remove this notice #
#######################################################
## The lines below need to be edited...
###################### Set up the following variables ######################
#
$to = "mandypen_99@yahoo.com"; #set address to send form to
$subject = "Results from your Request Info form"; #set the subject line
$headers = "From: Form Mailer"; #set the from address, or any other headers
$forward = 0; # redirect? 1 : yes || 0 : no
$location = "thankyou.htm"; #set page to redirect to, if 1 is above
#
##################### No need to edit below this line ######################
## set up the time ##
$date = date ("l, F jS, Y");
$time = date ("h:i A");
## mail the message ##
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}
?>
All I've done is change the line in the $to field to an email address (and create a page called "thankyou.htm"). When I click on the submit button, a download dialogue box appears - I thought this seemed odd! I accepted the download, but nothing was emailed to the email address.
I'm sorry for my vagueness, I really have no idea what I'm doing here as I only have experience of HTML and have been advised via that forum that this script would be the best way of processing the form,
thanks for any help!