Hey All,
I have a question. I am using the below free code to submit forms and i'm having problems trying to get my forms to have "required" input fields and I just can't figure out how to do it.
Here is the code that is a .php file that my forms submit using:
<?php
$MailToAddress = "[email protected]"; // your email address
$MailSubject = "From Submission From MYDOMAIN.com Website"; // the subject of the message
$redirectURL = "http://www.MYDOMAIN.com/thankyou.htm"; // the URL of the thank you page.
$errorURL = "http://www.MYDOMAIN.com/error.htm"; // the URL of the error page.
# If you are asking for an email address in your form, you can name that input field "email".
# If you do this, the message will apear to come from that email address and you can simply click the reply button to answer it.
# You can use this scirpt to submit your forms or to receive orders by email.
# You need to send the form as POST!
# If you have a multiple selection box, or multiple checkboxes, you MUST name the multiple list box or checkbox as "name[]" with "[]" at the end of the name
# This script was made by George A. & Calin S. from Web4Future.com
# There are no copyrights in the e-mails sent, and we do not ask for anything in return.
# DO NOT EDIT BELOW THIS LINE ============================================================
# ver. 1.1
if (!is_array($HTTP_POST_VARS))
return;
reset($HTTP_POST_VARS);
while(list($key, $val) = each($HTTP_POST_VARS)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$Message .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$Message .= "$vala, ";
}
$Message .= "<br>";
}
else {
$val = stripslashes($val);
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $Message .= "$key: - <br>"; }
else { $Message .= "<b>$key:</b> $val<br>"; }
}
}
} // end while
if (!$email) { $email ="[email protected]"; }
if (!$Message) { header("Location: ".$errorURL); exit; }
else { $Message = "<font face=verdana size=2>".$Message; }
mail( $MailToAddress, $MailSubject, $Message, "Content-Type: text/html; charset=ISO-8859-1\r\nFrom: ".$email);
header("Location: ".$redirectURL);
?>
AND HERE IS THE CODE THAT I NORMALLY USE TO SUBMIT THE FORM:
<form method="post" action="script.php">
<input type="hidden" name="recipient" value="[email protected]"><input type="hidden" name="redirect" value="http://www.MYDOMAIN.COM/thankyou.htm">
-----
Any help you anyone could provide would be greatly appreciated. Thank you
I have a question. I am using the below free code to submit forms and i'm having problems trying to get my forms to have "required" input fields and I just can't figure out how to do it.
Here is the code that is a .php file that my forms submit using:
<?php
$MailToAddress = "[email protected]"; // your email address
$MailSubject = "From Submission From MYDOMAIN.com Website"; // the subject of the message
$redirectURL = "http://www.MYDOMAIN.com/thankyou.htm"; // the URL of the thank you page.
$errorURL = "http://www.MYDOMAIN.com/error.htm"; // the URL of the error page.
# If you are asking for an email address in your form, you can name that input field "email".
# If you do this, the message will apear to come from that email address and you can simply click the reply button to answer it.
# You can use this scirpt to submit your forms or to receive orders by email.
# You need to send the form as POST!
# If you have a multiple selection box, or multiple checkboxes, you MUST name the multiple list box or checkbox as "name[]" with "[]" at the end of the name
# This script was made by George A. & Calin S. from Web4Future.com
# There are no copyrights in the e-mails sent, and we do not ask for anything in return.
# DO NOT EDIT BELOW THIS LINE ============================================================
# ver. 1.1
if (!is_array($HTTP_POST_VARS))
return;
reset($HTTP_POST_VARS);
while(list($key, $val) = each($HTTP_POST_VARS)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$Message .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$Message .= "$vala, ";
}
$Message .= "<br>";
}
else {
$val = stripslashes($val);
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $Message .= "$key: - <br>"; }
else { $Message .= "<b>$key:</b> $val<br>"; }
}
}
} // end while
if (!$email) { $email ="[email protected]"; }
if (!$Message) { header("Location: ".$errorURL); exit; }
else { $Message = "<font face=verdana size=2>".$Message; }
mail( $MailToAddress, $MailSubject, $Message, "Content-Type: text/html; charset=ISO-8859-1\r\nFrom: ".$email);
header("Location: ".$redirectURL);
?>
AND HERE IS THE CODE THAT I NORMALLY USE TO SUBMIT THE FORM:
<form method="post" action="script.php">
<input type="hidden" name="recipient" value="[email protected]"><input type="hidden" name="redirect" value="http://www.MYDOMAIN.COM/thankyou.htm">
-----
Any help you anyone could provide would be greatly appreciated. Thank you















