What's wrong with this code?
Posted: Mon May 14, 2007 11:44 am
Hello all, I'm new to this forum and also rather new to PHP. I wonder if anyone can spot the error in my code below:
My goal is to display different content in place of the form after the user submits their connection speed, by using the value of the "conspeed" radio buttons to choose an include file, such as "slow.inc" or "fast.inc". Before the form is submitted, everything works fine. However, after submitting the form, nothing is displayed at the desired location in the page.
Any help will be much appreciated!
Code: Select all
<?php
if (array_key_exists('_submit_check', $_POST)) {
require("content/{$_POST["conspeed"]}.inc");
}
else {
print
"<P>Please select your connection speed</P>
<FORM NAME='speedform' ID='speedform' METHOD='POST' ACTION='template.php?pgCo=media'>
<input type='radio' name='conspeed' value='xslow' /> 28.8K Modem<br />
<input type='radio' name='conspeed' value='slow' selected /> 56K Modem<br />
<input type='radio' name='conspeed' value='med' /> DSL<br />
<input type='radio' name='conspeed' value='fast' /> Cable Modem/Broadband<br />
<input type='hidden' name='_submit_check' value='1'/>
<input type='submit' name='submit' value='Submit' />
</FORM>";
}
?>Any help will be much appreciated!