nicsnow Posted August 24, 2008 Share Posted August 24, 2008 Hi, going a bit code blind here! I've got an english test page for overseas students (free.html) which processes for email delivery through a php page (free.php). This then kicks in a 'thanks very much' html page. Trouble is although the free.html page publishes, on submitting all I get back is a blank free.php page. I've done loads of these before but I'm obviously missing the plot somewhere. Help/guidance/reminding would be much appreciated. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/121095-solved-form-posting-mystery/ Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 You'll need to show use some code. When a blank page occurs this usually means there is an error. Quote Link to comment https://forums.phpfreaks.com/topic/121095-solved-form-posting-mystery/#findComment-624262 Share on other sites More sharing options...
nicsnow Posted August 24, 2008 Author Share Posted August 24, 2008 No problem here's the php bit <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Free Test</title> </head> <body><?php // get posted data into local variables $EmailFrom = "freetest@citizenet.co.uk"; $EmailTo = "esol@citizenet.co.uk"; $Subject = "Free Test Submission"; $Name = Trim(stripslashes($_POST['Name'])); $Email = Trim(stripslashes($_POST['Email'])); $1AConservative = Trim(stripslashes($_POST['1AConservative'])); $1BLabour = Trim(stripslashes($_POST['1BLabour'])); $1CLiberalDemocrat = Trim(stripslashes($_POST['1CLiberalDemocrat'])); $1DGreenParty = Trim(stripslashes($_POST['1DGreenParty'])); $2AQueenElizabeth1 = Trim(stripslashes($_POST['2AQueenElizabeth1'])); $2BQueenElizabeth2 = Trim(stripslashes($_POST['2BQueenElizabeth2'])); $2CQueenAnne1 = Trim(stripslashes($_POST['2CQueenAnne1'])); $3AUK2 = Trim(stripslashes($_POST['3AUK2'])); $3BUK4 = Trim(stripslashes($_POST['3BUK4'])); $3CUK3 = Trim(stripslashes($_POST['3CUK3'])); $3DUK1 = Trim(stripslashes($_POST['3DUK1'])); $4ACarmarthen = Trim(stripslashes($_POST['4ACarmarthen'])); $4BCardiff = Trim(stripslashes($_POST['4BCardiff'])); $4CLondon = Trim(stripslashes($_POST['4CLondon'])); $4DDublin = Trim(stripslashes($_POST['4DDublin'])); $5AGordonBrown = Trim(stripslashes($_POST['5AGordonBrown'])); $5BTonyBlair = Trim(stripslashes($_POST['5BTonyBlair'])); $5CDavidCameron = Trim(stripslashes($_POST['5CDavidCameron'])); $5DDavidMilliband = Trim(stripslashes($_POST['5DDavidMilliband'])); $6AStPatrick = Trim(stripslashes($_POST['6AStPatrick'])); $6BStGeorge = Trim(stripslashes($_POST['6BStGeorge'])); $6CStAndrew = Trim(stripslashes($_POST['6CStAndrew'])); $7AStGeorge = Trim(stripslashes($_POST['7AStGeorge'])); $7BStDavid = Trim(stripslashes($_POST['7BStDavid'])); $7CStAndrew = Trim(stripslashes($_POST['7CStAndrew'])); $8ANaturalHealthService = Trim(stripslashes($_POST['8ANaturalHealthService'])); $8BNationalHealthService = Trim(stripslashes($_POST['8BNationalHealthService'])); $8CNationalHealthSupply = Trim(stripslashes($_POST['8CNationalHealthSupply'])); $9A4Years = Trim(stripslashes($_POST['9A4Years'])); $9B5Years = Trim(stripslashes($_POST['9B5Years'])); $9C6Years = Trim(stripslashes($_POST['9C6Years'])); $10A15Years = Trim(stripslashes($_POST['10A15Years'])); $10B16Years = Trim(stripslashes($_POST['10B16Years'])); $10C18Years = Trim(stripslashes($_POST['10C18Years'])); $11AKingCharles = Trim(stripslashes($_POST['11AKingCharles'])); $11BPrinceCharles = Trim(stripslashes($_POST['11BPrinceCharles'])); $11CKingPhillip = Trim(stripslashes($_POST['11CKingPhillip'])); $11DPrincePhillip = Trim(stripslashes($_POST['11DPrincePhillip'])); $12A11October = Trim(stripslashes($_POST['12A11October'])); $12B11November = Trim(stripslashes($_POST['12B11November'])); $12C1May = Trim(stripslashes($_POST['12C1May'])); $12D3September = Trim(stripslashes($_POST['12D3September'])); $13ARealCatholic = Trim(stripslashes($_POST['13ARealCatholic'])); $13BRomanChristian = Trim(stripslashes($_POST['13BRomanChristian'])); $13CRomanCatholic = Trim(stripslashes($_POST['13CRomanCatholic'])); $14A60Mph = Trim(stripslashes($_POST['14A60Mph'])); $14B70Mph = Trim(stripslashes($_POST['14B70Mph'])); $14C80Mph = Trim(stripslashes($_POST['14C80Mph'])); $14DNoSpeedLimit = Trim(stripslashes($_POST['14DNoSpeedLimit'])); $15ATrue = Trim(stripslashes($_POST['15ATrue'])); $15BFalse = Trim(stripslashes($_POST['15BFalse'])); $16A1939 = Trim(stripslashes($_POST['16A1939'])); $16B1945 = Trim(stripslashes($_POST['16B1945'])); $16C1973 = Trim(stripslashes($_POST['16C1973'])); $16D1980 = Trim(stripslashes($_POST['16D1980'])); $17ADaffodil = Trim(stripslashes($_POST['17ADaffodil'])); $17BRose = Trim(stripslashes($_POST['17BRose'])); $17CPoppy = Trim(stripslashes($_POST['17CPoppy'])); $18ATheIslandsAroundScotland = Trim(stripslashes($_POST['18ATheIslandsAroundScotland'])); $18BIreland = Trim(stripslashes($_POST['18BIreland'])); $18CNorthernEngland = Trim(stripslashes($_POST['18CNorthernEngland'])); $18DWales = Trim(stripslashes($_POST['18DWales'])); $19ATrue = Trim(stripslashes($_POST['19ATrue'])); $19BFalse = Trim(stripslashes($_POST['19BFalse'])); $20A16 = Trim(stripslashes($_POST['20A16'])); $20B18 = Trim(stripslashes($_POST['20B18'])); $20C21 = Trim(stripslashes($_POST['20C21'])); $20D25 = Trim(stripslashes($_POST['20D25'])); $21ABuyTicketsBeforeBoardingTrain = Trim(stripslashes($_POST['21ABuyTicketsBeforeBoardingTrain'])); $21BBuyTicketsAfterGettingOffTrain = Trim(stripslashes($_POST['21BBuyTicketsAfterGettingOffTrain'])); $22A450 = Trim(stripslashes($_POST['22A450'])); $22B620 = Trim(stripslashes($_POST['22B620'])); $22C720 = Trim(stripslashes($_POST['22C720'])); $23AUnder16 = Trim(stripslashes($_POST['23AUnder16'])); $23BWorkingAdults = Trim(stripslashes($_POST['23BWorkingAdults'])); $23CPregnantWomen = Trim(stripslashes($_POST['23CPregnantWomen'])); $23DEveryone = Trim(stripslashes($_POST['23DEveryone'])); $24ATrue = Trim(stripslashes($_POST['24ATrue'])); $24BFalse = Trim(stripslashes($_POST['24BFalse'])); // validation $validationOK=true; if (!$validationOK) { Â print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; Â exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "1AConservative: "; $Body .= $1AConservative; $Body .= "\n"; $Body .= "1BLabour: "; $Body .= $1BLabour; $Body .= "\n"; $Body .= "1CLiberalDemocrat: "; $Body .= $1CLiberalDemocrat; $Body .= "\n"; $Body .= "1DGreenParty: "; $Body .= $1DGreenParty; $Body .= "\n"; $Body .= "2AQueenElizabeth1: "; $Body .= $2AQueenElizabeth1; $Body .= "\n"; $Body .= "2BQueenElizabeth2: "; $Body .= $2BQueenElizabeth2; $Body .= "\n"; $Body .= "2CQueenAnne1: "; $Body .= $2CQueenAnne1; $Body .= "\n"; $Body .= "3AUK2: "; $Body .= $3AUK2; $Body .= "\n"; $Body .= "3BUK4: "; $Body .= $3BUK4; $Body .= "\n"; $Body .= "3CUK3: "; $Body .= $3CUK3; $Body .= "\n"; $Body .= "3DUK1: "; $Body .= $3DUK1; $Body .= "\n"; $Body .= "4ACarmarthen: "; $Body .= $4ACarmarthen; $Body .= "\n"; $Body .= "4BCardiff: "; $Body .= $4BCardiff; $Body .= "\n"; $Body .= "4CLondon: "; $Body .= $4CLondon; $Body .= "\n"; $Body .= "4DDublin: "; $Body .= $4DDublin; $Body .= "\n"; $Body .= "5AGordonBrown: "; $Body .= $5AGordonBrown; $Body .= "\n"; $Body .= "5BTonyBlair: "; $Body .= $5BTonyBlair; $Body .= "\n"; $Body .= "5CDavidCameron: "; $Body .= $5CDavidCameron; $Body .= "\n"; $Body .= "5DDavidMilliband: "; $Body .= $5DDavidMilliband; $Body .= "\n"; $Body .= "6AStPatrick: "; $Body .= $6AStPatrick; $Body .= "\n"; $Body .= "6BStGeorge: "; $Body .= $6BStGeorge; $Body .= "\n"; $Body .= "6CStAndrew: "; $Body .= $6CStAndrew; $Body .= "\n"; $Body .= "7AStGeorge: "; $Body .= $7AStGeorge; $Body .= "\n"; $Body .= "7BStDavid: "; $Body .= $7BStDavid; $Body .= "\n"; $Body .= "7CStAndrew: "; $Body .= $7CStAndrew; $Body .= "\n"; $Body .= "8ANaturalHealthService: "; $Body .= $8ANaturalHealthService; $Body .= "\n"; $Body .= "8BNationalHealthService: "; $Body .= $8BNationalHealthService; $Body .= "\n"; $Body .= "8CNationalHealthSupply: "; $Body .= $8CNationalHealthSupply; $Body .= "\n"; $Body .= "9A4Years: "; $Body .= $9A4Years; $Body .= "\n"; $Body .= "9B5Years: "; $Body .= $9B5Years; $Body .= "\n"; $Body .= "9C6Years: "; $Body .= $9C6Years; $Body .= "\n"; $Body .= "10A15Years: "; $Body .= $10A15Years; $Body .= "\n"; $Body .= "10B16Years: "; $Body .= $10B16Years; $Body .= "\n"; $Body .= "10C18Years: "; $Body .= $10C18Years; $Body .= "\n"; $Body .= "11AKingCharles: "; $Body .= $11AKingCharles; $Body .= "\n"; $Body .= "11BPrinceCharles: "; $Body .= $11BPrinceCharles; $Body .= "\n"; $Body .= "11CKingPhillip: "; $Body .= $11CKingPhillip; $Body .= "\n"; $Body .= "11DPrincePhillip: "; $Body .= $11DPrincePhillip; $Body .= "\n"; $Body .= "12A11October: "; $Body .= $12A11October; $Body .= "\n"; $Body .= "12B11November: "; $Body .= $12B11November; $Body .= "\n"; $Body .= "12C1May: "; $Body .= $12C1May; $Body .= "\n"; $Body .= "12D3September: "; $Body .= $12D3September; $Body .= "\n"; $Body .= "13ARealCatholic: "; $Body .= $13ARealCatholic; $Body .= "\n"; $Body .= "13BRomanChristian: "; $Body .= $13BRomanChristian; $Body .= "\n"; $Body .= "13CRomanCatholic: "; $Body .= $13CRomanCatholic; $Body .= "\n"; $Body .= "14A60Mph: "; $Body .= $14A60Mph; $Body .= "\n"; $Body .= "14B70Mph: "; $Body .= $14B70Mph; $Body .= "\n"; $Body .= "14C80Mph: "; $Body .= $14C80Mph; $Body .= "\n"; $Body .= "14DNoSpeedLimit: "; $Body .= $14DNoSpeedLimit; $Body .= "\n"; $Body .= "15ATrue: "; $Body .= $15ATrue; $Body .= "\n"; $Body .= "15BFalse: "; $Body .= $15BFalse; $Body .= "\n"; $Body .= "16A1939: "; $Body .= $16A1939; $Body .= "\n"; $Body .= "16B1945: "; $Body .= $16B1945; $Body .= "\n"; $Body .= "16C1973: "; $Body .= $16C1973; $Body .= "\n"; $Body .= "16D1980: "; $Body .= $16D1980; $Body .= "\n"; $Body .= "17ADaffodil: "; $Body .= $17ADaffodil; $Body .= "\n"; $Body .= "17BRose: "; $Body .= $17BRose; $Body .= "\n"; $Body .= "17CPoppy: "; $Body .= $17CPoppy; $Body .= "\n"; $Body .= "18ATheIslandsAroundScotland: "; $Body .= $18ATheIslandsAroundScotland; $Body .= "\n"; $Body .= "18BIreland: "; $Body .= $18BIreland; $Body .= "\n"; $Body .= "18CNorthernEngland: "; $Body .= $18CNorthernEngland; $Body .= "\n"; $Body .= "18DWales: "; $Body .= $18DWales; $Body .= "\n"; $Body .= "19ATrue: "; $Body .= $19ATrue; $Body .= "\n"; $Body .= "19BFalse: "; $Body .= $19BFalse; $Body .= "\n"; $Body .= "20A16: "; $Body .= $20A16; $Body .= "\n"; $Body .= "20B18: "; $Body .= $20B18; $Body .= "\n"; $Body .= "20C21: "; $Body .= $20C21; $Body .= "\n"; $Body .= "20D25: "; $Body .= $20D25; $Body .= "\n"; $Body .= "21ABuyTicketsBeforeBoardingTrain: "; $Body .= $21ABuyTicketsBeforeBoardingTrain; $Body .= "\n"; $Body .= "21BBuyTicketsAfterGettingOffTrain: "; $Body .= $21BBuyTicketsAfterGettingOffTrain; $Body .= "\n"; $Body .= "22A450: "; $Body .= $22A450; $Body .= "\n"; $Body .= "22B620: "; $Body .= $22B620; $Body .= "\n"; $Body .= "22C720: "; $Body .= $22C720; $Body .= "\n"; $Body .= "23AUnder16: "; $Body .= $23AUnder16; $Body .= "\n"; $Body .= "23BWorkingAdults: "; $Body .= $23BWorkingAdults; $Body .= "\n"; $Body .= "23CPregnantWomen: "; $Body .= $23CPregnantWomen; $Body .= "\n"; $Body .= "23DEveryone: "; $Body .= $23DEveryone; $Body .= "\n"; $Body .= "24ATrue: "; $Body .= $24ATrue; $Body .= "\n"; $Body .= "24BFalse: "; $Body .= $24BFalse; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ Â print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.html\">"; } else{ Â print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/121095-solved-form-posting-mystery/#findComment-624263 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 One problem I see straight away is variables cannot start with a number, variables must start with a letter (a-z) or an underscore. Quote Link to comment https://forums.phpfreaks.com/topic/121095-solved-form-posting-mystery/#findComment-624271 Share on other sites More sharing options...
nicsnow Posted August 24, 2008 Author Share Posted August 24, 2008 Ah Ha! Forgotten about that - shall have to forfeit lunch now! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/121095-solved-form-posting-mystery/#findComment-624273 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 As you're doing the same thing on each $_POST variable, I'd change your code to <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Free Test</title> </head> <body><?php // get posted data into local variables $EmailFrom = "freetest@citizenet.co.uk"; $EmailTo = "esol@citizenet.co.uk"; $Subject = "Free Test Submission"; $fields = array('Name', 'Email',         '1AConservative', '1BLabour', '1CLiberalDemocrat', '1DGreenParty',         '2AQueenElizabeth1', '2BQueenElizabeth2', '2CQueenAnne1',         '3AUK2', '3BUK4', '3CUK3', '3DUK1',         '4ACarmarthen', '4BCardiff', '4CLondon', '4DDublin',         '5AGordonBrown', '5BTonyBlair', '5CDavidCameron', '5DDavidMilliband',         '6AStPatrick', '6BStGeorge', '6CStAndrew',         '7AStGeorge', '7BStDavid', '7CStAndrew',         '8ANaturalHealthService', '8BNationalHealthService', '8CNationalHealthSupply',         '9A4Years', '9B5Years', '9C6Years',         '10A15Years', '10B16Years', '10C18Years',         '11AKingCharles', '11BPrinceCharles', '11CKingPhillip', '11DPrincePhillip',         '12A11October', '12B11November', '12C1May', '12D3September',         '13ARealCatholic', '13BRomanChristian', '13CRomanCatholic',         '14A60Mph', '14B70Mph', '14C80Mph', '14DNoSpeedLimit',         '15ATrue', '15BFalse',         '16A1939', '16B1945', '16C1973', '16D1980',         '17ADaffodil', '17BRose', '17CPoppy',         '18ATheIslandsAroundScotland', '18BIreland', '18CNorthernEngland', '18DWales',         '19ATrue', '19BFalse',         '20A16', '20B18', '20C21', '20D25',         '21ABuyTicketsBeforeBoardingTrain', '21BBuyTicketsAfterGettingOffTrain',         '22A450', '22B620', '22C720',         '23AUnder16', '23BWorkingAdults', '23CPregnantWomen', '23DEveryone',         '24ATrue', '24BFalse'); $Body = ''; foreach($fields as $field) {   $value = '';   if(isset($_POST[$field]))   {     $value = trim(stripslashes($_POST[$field]));   }   $Body .= $field.": \n";   $Body .= $_POST[$field]."\n"; } // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){  print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.html\">"; } else{  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> </body> </html>  Quote Link to comment https://forums.phpfreaks.com/topic/121095-solved-form-posting-mystery/#findComment-624281 Share on other sites More sharing options...
nicsnow Posted August 24, 2008 Author Share Posted August 24, 2008 cheers for that Quote Link to comment https://forums.phpfreaks.com/topic/121095-solved-form-posting-mystery/#findComment-624283 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.