Don't assume $_POST['option'] has a value, it might not have a value (if the form hasn't been submitted). Use isset() to check if it has a value first.
Was an error message produced? Because $option==read would generate a notice. You should write $option == "read"
Does the problem (bring you to the index page) happen when you include this file on another script or when you include another file into this script? That part wasn't clear for me. What index page is this? Is this script on the index page?
Let me rewrite the PHP part for you:
<?php
if (isset($_POST['option'])) {
switch ($_POST['option']) {
case 'read':
include ('book.inc');
break;
case 'movies':
include ('music.inc');
break;
}
...
}
?>
Main Topics
Browse All Topics





by: nicholassolutionsPosted on 2005-07-11 at 20:28:08ID: 14418291
Well first off,
$option==read should be $option=='read'