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
https://forums.phpfreaks.com/topic/60973-_request/
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
https://forums.phpfreaks.com/topic/60973-_request/#findComment-303399
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
https://forums.phpfreaks.com/topic/60973-_request/#findComment-303401
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
https://forums.phpfreaks.com/topic/60973-_request/#findComment-303433
Share on other sites

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.