PDA

View Full Version : PHP form Processor HELP


BigJohnson
12-24-2002, 02:12 AM
I am creating this form processor and integrating it with my vbulletin.


<html>
<head></head>
<body>
<?
/*Script developed by Nadine Gaine.
You can freely use, modify and distribute for NON-COMMERCIAL purposes only
If you decide to use it, giving me the credit would be appreciated.*/

$MailTo = "nemesis1386@new-dimensionz.com"; //recipient of the form results
$MailSubject = "TESTING THIS Out"; //text in the Subject field of the mail
$MailHeader = "From: [FSU] Clan"; //text in the From field of the mail

/* Following routines put values entered in the form fields into variables and then put the results in the global variable MailBody which will be the Body part of the message */

$Envoi = 1; //give value 1 to the variable $Envoi

if ($champ1 == ""){ //name of field 1
echo("<font face=verdana size=2>You forgot to complete field 1.</font><br>"); //message to be displayed if the field is left empty
$Envoi = 0; //if field 1 is empty, variable $Envoi takes value 0
}
else {
$MailBody = "Question 1 : $champ1\n"; //if field 1 has been completed, value is inserted in variable MailBody
}
if ($champ2 == ""){
echo("<font face=verdana size=2>You forgot to complete field 2.</font><br>");
$Envoi = 1;
$MailBody .= "Question 2 : $champ2\n";
}
if ($champ3 == ""){
echo("<font face=verdana size=2>You forgot to complete field 3</font><br>");
$Envoi = 0;
}
else {
$MailBody .= "Question 3 : $champ3\n";
}
if ($champ4 == ""){
echo("<font face=verdana size=2>You forgot to complete field 4</font><br>");
$Envoi = 0;
}
else {
$MailBody .= "Question 4 : $champ4\n";
}
if ($champ5 == "0"){
echo("<font face=verdana size=2>You forgot to choose a value.</font><br>");
$Envoi = 0;
}
else {
$MailBody .= "Question 5 : $champ5\n";
}
if ($champ6 == ""){
echo("<font face=verdana size=2>You forgot to complete field 6.</font><br>");
$Envoi = 0;
}
else {
$MailBody .= "Question 6 : $champ6\n";
}
if ($champ7 == ""){
echo("<font face=verdana size=2>You forgot to specify your preferences to question 7.</font><br>");
$Envoi = 0;
}
else {
$MailBody .= "Question 7 : $champ7\n";
}

//Routine for checkboxes

$MailBody .="Question 8 : ";

$items = 3; //initiate possible # of items

for ($i = 1; $i <= $items; $i++) { //loop on # of items

$MailBody .= "$champ8[$i], "; //put results in variable MailBody
}

//Routine to send message

if ($Envoi == 1) { //Check that variable $Envoi has value 1
mail($MailTo, $MailSubject, $MailBody, $MailHeader); //message send
echo("<p><font face=verdana size=2>Your message has been sent.<br>Thank you for your comments.</font>"); //Confirmation message.
}
?>
</body>
</html>


The code at the very end echo("<p><font face=verdana size=2>Your message has been sent.<br>Thank you for your comments.</font>"); //Confirmation message.
When u fill out the form and u click send you get the message in the echo tags.

I don't want that. I want it when u press send it redirects you to another html page that i have which will then show the message that the form was sent.

I tried using

header("Location: http://www.php.net"); //Confirmation message.

but does no work. All it says

Cannot add header information - headers already sent by (output started at

Please help me out thanks.

Xenon
12-24-2002, 10:00 AM
take out these line:<html>
<head></head>
<body>

there should not be any char before the <? tag then the header() function should work

DrkFusion
12-27-2002, 02:07 PM
I was wondering can
header() redirect, also send variables, for instance on one page, after I fill out a forum I click submit, then the page I go to after I press submit, can I have a redirect, and the I need the variables from the form to get passed, now I also do not want it to show up in the url for ex: index2.php?name=Stefan%20Kaeser&age=991

Would you know, please and thank you.