Hi,
I know i shouldn't work on php forms when i'm going on 30 hours of no sleep,
but i did anyway. I'm trying to get the below to work, and i keep getting a
parse error line 74, an unexpected
','
there is none, so i'm assuming it's on another line, i've checked around,
but don't see it. I'm probably missing something so simple that i'll call
myself dumb for a month, but that's later, as of now i'd appreciate any
help/suggestions.
Thanks.
Dave.
<?php
// orderform.php script
// Created 20040730 by Dave M Mehler
// Purpose: collect order form information, process it, data verification,
// email designated users, and redirect visitor to a thank you page.
?>
<html>
<head>
<title>streetfr eakzperformance product order</title>
</head>
<body bgcolor="#fffff f" text="#000000" link="#cbda74" vlink="#808040"
alink="#808040" >
<?
$form = "
<form action=\"orderf orm.php\" method=\"post\" >
<input type=\"hidden\" name=\"seenform \" value=\"y\">
<h1>Streetfreak zperformance Product Ordering Page</h1>
<p>Thank you for wishing to purchase products produced by
<b>streetfreakz performance.com </b>! Please fill out the following form,
fields marked with a * (*) are required. You will recieve a confirmation
email</p>
Your Name:<br />
<input type=\"text\" name=\"name\" size=\"20\" maxlength=\"20\ "
value=\"\"><br />
Your Email:<br />
<input type=\"text\" name=\"email\" size=\"20\" maxlength=\"40\ "
value=\"\"><br />
Your Comments:<br />
<textarea name=\"comments \" rows=\"3\" cols=\"30\"></textarea><br />
<input type=\"submit\" value=\"submit! \">
<input type=\"clear\" value=\"clear!\ ">
</form>
";
// If we haven't already seen the form ($seenform passed by hidden
// form value), show the form.
if ($seenform != "y") :
print "$form";
// The user has filled out the form. Now verify the information
else :
$error_flag = "n";
// ensure that the name variable is not empty
if ($name == "") :
print "<font color=\"red\">* You forgot to enter your name!</font>
<br />";
$error_flag = "y";
endif;
// ensure that the email variable is not empty
if ($email == "") :
print "<font color=\"red\">* You forgot to enter your email!</font>
<br />";
$error_flag = "y";
else :
// convert all email alphabetical characters to lowercase
$email = strtolower(trim ($email));
// ensure the email address is of valid syntax
if (! @eregi('^[0-9a-z]+'.
'@'.
'([0-9a-z-]+\.)+'.
'([0-9a-z]){2,4}$', $email)) :
print "<font color=\"red\">* You entered an invalid email
address!</font> <br />";
$error_flag = "y";
endif;
endif;
endif;
// If the $error_flag has been set, redisplay the form
if ($error_flag == "y") :
print "$form";
else :
// change $recipient to be the recipient of the form information
$recipient = "testuser@examp le.com";
// email subject
$subject = "streetfreakzpe rformance product order request ($name)";
// extra email headers
$headers = "From: $email";
// send the email or produce an error
mail($recipient , $subject, $comments, $headers) or die("Could not send
email!");
// send the user an appropriate message
print "Thank you", $name, "for taking a moment to send us your comments!";
endif;
?>
</body>
</html>
I know i shouldn't work on php forms when i'm going on 30 hours of no sleep,
but i did anyway. I'm trying to get the below to work, and i keep getting a
parse error line 74, an unexpected
','
there is none, so i'm assuming it's on another line, i've checked around,
but don't see it. I'm probably missing something so simple that i'll call
myself dumb for a month, but that's later, as of now i'd appreciate any
help/suggestions.
Thanks.
Dave.
<?php
// orderform.php script
// Created 20040730 by Dave M Mehler
// Purpose: collect order form information, process it, data verification,
// email designated users, and redirect visitor to a thank you page.
?>
<html>
<head>
<title>streetfr eakzperformance product order</title>
</head>
<body bgcolor="#fffff f" text="#000000" link="#cbda74" vlink="#808040"
alink="#808040" >
<?
$form = "
<form action=\"orderf orm.php\" method=\"post\" >
<input type=\"hidden\" name=\"seenform \" value=\"y\">
<h1>Streetfreak zperformance Product Ordering Page</h1>
<p>Thank you for wishing to purchase products produced by
<b>streetfreakz performance.com </b>! Please fill out the following form,
fields marked with a * (*) are required. You will recieve a confirmation
email</p>
Your Name:<br />
<input type=\"text\" name=\"name\" size=\"20\" maxlength=\"20\ "
value=\"\"><br />
Your Email:<br />
<input type=\"text\" name=\"email\" size=\"20\" maxlength=\"40\ "
value=\"\"><br />
Your Comments:<br />
<textarea name=\"comments \" rows=\"3\" cols=\"30\"></textarea><br />
<input type=\"submit\" value=\"submit! \">
<input type=\"clear\" value=\"clear!\ ">
</form>
";
// If we haven't already seen the form ($seenform passed by hidden
// form value), show the form.
if ($seenform != "y") :
print "$form";
// The user has filled out the form. Now verify the information
else :
$error_flag = "n";
// ensure that the name variable is not empty
if ($name == "") :
print "<font color=\"red\">* You forgot to enter your name!</font>
<br />";
$error_flag = "y";
endif;
// ensure that the email variable is not empty
if ($email == "") :
print "<font color=\"red\">* You forgot to enter your email!</font>
<br />";
$error_flag = "y";
else :
// convert all email alphabetical characters to lowercase
$email = strtolower(trim ($email));
// ensure the email address is of valid syntax
if (! @eregi('^[0-9a-z]+'.
'@'.
'([0-9a-z-]+\.)+'.
'([0-9a-z]){2,4}$', $email)) :
print "<font color=\"red\">* You entered an invalid email
address!</font> <br />";
$error_flag = "y";
endif;
endif;
endif;
// If the $error_flag has been set, redisplay the form
if ($error_flag == "y") :
print "$form";
else :
// change $recipient to be the recipient of the form information
$recipient = "testuser@examp le.com";
// email subject
$subject = "streetfreakzpe rformance product order request ($name)";
// extra email headers
$headers = "From: $email";
// send the email or produce an error
mail($recipient , $subject, $comments, $headers) or die("Could not send
email!");
// send the user an appropriate message
print "Thank you", $name, "for taking a moment to send us your comments!";
endif;
?>
</body>
</html>
Comment