latheesan
08-16-2005, 06:40 AM
I've done my index page using php switch function, so i can have my header and the footer static and the middle bit rotation on request to right page.
e.g.
<?php
define ("IN_SCRIPT", "true");
include ("header.php");
switch($id){
case "page1";
include ("page1.php");
break;
case "page2";
include ("page2.php");
break;
case "admin";
include ("admin/index.php");
break;
default:
include ("home.php");
break;
}
include ("footer.php");
?>
Then on the page1.php, i have this drop downlist that shows a list of albums in the database, and when one album is clicked. it goes to the view.php?id=album name like this
i didnt wanted the user leaving the page index.php?id=page1 so what i did was created another similar php switch function like this:
<?php
if ($view == "view"){
include ("view.php");
exit();
}else{
if (!defined('IN_SCRIPT')){
echo "Sorry, you can't access this page directly!";
}
else{
//The real content
echo " A HTML TABLE WITH A DYNAMIC DROPDOWN LIST OF ALL THE ALBUMS IN THE LIST IS HERE ";
}
}
?>
so, i go to the page1 by accessing http://www.mysite.com/index.php?id=page1
i see drop down list of albums, so i click on an album called "Summer" for e.g.
this request goes to the view.php file like this
http://www.mysite.com?id=page1&view?id=Summer
Here's the problem, i see the http://www.mysite.com/index.php?id=page1 refreshed, i dont see the results im suppose to see
to test if the files are working accordingly, i tpyed the address like this
http://www.mysite.com/view.php?id=Summer
and all the songs within the album "Summer" were displayed nicely.
:( So what's wrong with my coding, how comes it keeps refreshing, instead of showing the results like the view.php file at the url
http://www.mysite.com/index.php?id=page&view?id=Summer
???
e.g.
<?php
define ("IN_SCRIPT", "true");
include ("header.php");
switch($id){
case "page1";
include ("page1.php");
break;
case "page2";
include ("page2.php");
break;
case "admin";
include ("admin/index.php");
break;
default:
include ("home.php");
break;
}
include ("footer.php");
?>
Then on the page1.php, i have this drop downlist that shows a list of albums in the database, and when one album is clicked. it goes to the view.php?id=album name like this
i didnt wanted the user leaving the page index.php?id=page1 so what i did was created another similar php switch function like this:
<?php
if ($view == "view"){
include ("view.php");
exit();
}else{
if (!defined('IN_SCRIPT')){
echo "Sorry, you can't access this page directly!";
}
else{
//The real content
echo " A HTML TABLE WITH A DYNAMIC DROPDOWN LIST OF ALL THE ALBUMS IN THE LIST IS HERE ";
}
}
?>
so, i go to the page1 by accessing http://www.mysite.com/index.php?id=page1
i see drop down list of albums, so i click on an album called "Summer" for e.g.
this request goes to the view.php file like this
http://www.mysite.com?id=page1&view?id=Summer
Here's the problem, i see the http://www.mysite.com/index.php?id=page1 refreshed, i dont see the results im suppose to see
to test if the files are working accordingly, i tpyed the address like this
http://www.mysite.com/view.php?id=Summer
and all the songs within the album "Summer" were displayed nicely.
:( So what's wrong with my coding, how comes it keeps refreshing, instead of showing the results like the view.php file at the url
http://www.mysite.com/index.php?id=page&view?id=Summer
???
