Jump to content

$_REQUEST


ItsWesYo

Recommended Posts

I did this once before, but I forgot how. It's starting to aggravate me now =\ I can't really explain it, but if you look at the code below, you will probably get it. My problem is that it doesn't go to the page (?id=1&section=1).

 

guides.php

<?php
$page = $_REQUEST['id'];

if($page == "1"){
echo ("

guide #1

<a href='?id=1&section=1'>part 1 of guide one</a>
<a href='?id=1&section=2'>part 2 of guide one</a>

");
include ("http://1.itswesyo.hypreed.com/inc/footer.php");
die();
}


elseif($page == "1&section=1"){
echo ("

guide #1, part 1

");
include ("http://1.itswesyo.hypreed.com/inc/footer.php");
die();
}


else {
echo ("

the main guide page

<a href='?id=1'>link to guide one</a>

");
die();
}

?>

Link to comment
Share on other sites

i dont really get it :S that code works 100%

 

do you mean this?

 

<?php
$page = $_REQUEST['id'];
$section = $_REQUEST['section'];

if($page == "1"){
echo ("

guide #1

<a href='?id=1&section=1'>part 1 of guide one</a>
<a href='?id=1&section=2'>part 2 of guide one</a>

");
include ("http://1.itswesyo.hypreed.com/inc/footer.php");
die();
}


if($page == "1" && $section="1"){
echo ("

guide #1, part 1

");
include ("http://1.itswesyo.hypreed.com/inc/footer.php");
die();
}
}


else {
echo ("

the main guide page

<a href='?id=1'>link to guide one</a>

");
die();
}

?>

 

got beaten to it, but hey, that code will work

Link to comment
Share on other sites

you could use $_SERVER(DOCUMENT_ROOT) to find the path of the file that you need to send to. or just put the file name in the path?

 

if you're referencing this as an include, do something like $page_name='index.php';

 

then change ?id=1 to index.php?id=1

 

hope this helps.

Link to comment
Share on other sites

ok, i modified it again, here is the new code:

 

<?php
$page = $_REQUEST['id'];
$section = $_GET['section'];

if($_GET['id'] == "1"){
echo ("guide #1<br><a href='?id=1&section=1'>part 1 of guide one</a><br><a href='?id=1&section=2'>part 2 of guide one</a><br><br><br>

");
include ("http://1.itswesyo.hypreed.com/inc/footer.php");



if(($_GET['id'] == "1") && ($_GET['section']=="1")){
echo ("

guide #1, part 1

");
include ("http://1.itswesyo.hypreed.com/inc/footer.php");
}

}


else {
echo ("

the main guide page

<a href='?id=1'>link to guide one</a>

");
}

?>

 

sorry, made some minor mistakes in it. That code uses $_GET rather than $_REQUEST, but you can change it

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.