Jump to content

Easy Navigation and $_GET.


lworks

Recommended Posts

you could go like this to define them:

[code]
if(!isset($_GET['section'])){ $section = 1; }else{ $section = $_GET['section']; }
if(!isset($_GET['page'])){ $page = 1; }else{ $page = $_GET['page']; }

switch($section){

//add other cases

case 'default':
something here
}
[/code]

then you can do the page you would do use in each section in your sql query's.
Example:
[code=php:0]switch($_GET['section'])
{
    case 1:
        // do stufff for section 1
    break;

    case 2:
        // do stufff for section 2
    break;

    // other cases here
   
    // defualt case:
    default:
        // do something here if $_GET['section'] doesnt match any of the cases
    break;
}[/code]
Actually, like if someone goes here: tutorals.php?section=1&page=2 .. now section 1 would be /tutorials/html/basics and page 2 would be /tutorials/html/basics-page-2.php. I don't understand how to get the page=2 into the URL..

[sub]if(!isset($_GET['section'])) {
$section = 1; }
else {
$section = $_GET['section'];
}
if(!isset($_GET['page'])) {
$page = 1;
}
else {
$page = $_GET['page'];
}
switch($section){
case '1':
include_once("/tutorials/html/basics/basics-THEPAGENUMBER.php");
break;
blah blah
}[/sub]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.