Jump to content

Passing Variables


ItsWesYo

Recommended Posts

I'm trying to make a guide for a site. I'll explain after I show the code:

 

guides.php:

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

if($page == "1"){
include ("http://www.mysite.com/files/guide_newbie.php");
die();
}

else {
echo ( "

<a href='?id=1'><b>Guide: Newbie</b></a>

");
die();
}

?>

 

Okay, basically: when someone visits 'guide.php', they come to that page of course. When they click the link on that page, they go to an included page called "guide_newbie.php" which is in a folder called "files".

 

My problem is: On "guide_newbie.php", I have 'if statements' to divide sections up. I'm trying to make it look like this:

 

id=1&sec=1

 

id would be the guide number included on "guides.php"

sec would be the guide section of Guide #1.

 

What I'm asking is, how do I do that?

Link to comment
https://forums.phpfreaks.com/topic/37636-passing-variables/
Share on other sites

Here, I posted the whole thing this time. Some of the code might be sloppy because my friend wanted it done before last night, but I still screwed up.

 

guides.php:

<?php
include ("http://www.1.projectwes.hyspex.com/includes/header.php");
$page = $_REQUEST['id'];

if($page == "1"){
include ("http://www.1.projectwes.hyspex.com/files/guide_bbcode.php");
die();
}

elseif($page == "2"){
include ("http://www.1.projectwes.hyspex.com/files/guide_games.php");
die();
}

elseif($page == "3"){
include ("http://www.1.projectwes.hyspex.com/files/guide_newbie.php");
die();
}


else {
echo ( "

<a href='?id=1'><b>Guide: BBCode</b></a><br>
View forum codes to use on the discussion boards.<br><br>

<a href='?id=2'><b>Guide: Games</b></a><br>
View information and tips for all of the games.<br><br>

<a href='?id=3'><b>Guide: Newbie</b></a><br>
View our extensive newbie guide on all topics.

");
die();
}

include ("http://www.1.projectwes.hyspex.com/includes/footer.php");
?>

 

 

files/guide_newbie.php: (this is toooo long, so I posted the main part)

<?php
$page = $_REQUEST['id'];
$menu = "1. <a href='?id=3&id=1'>Avatars</a><br>


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

gfhgfhgfh

" );
die();
}


else {
echo ( "

fgfgdfgfd

");
die();
}

?>

Link to comment
https://forums.phpfreaks.com/topic/37636-passing-variables/#findComment-180033
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.