I'm new and need help with .../whatever.php?page=0

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
leigh
Forum Newbie
Posts: 3
Joined: Mon Mar 13, 2006 8:51 pm

I'm new and need help with .../whatever.php?page=0

Post by leigh »

I'm really lost. I'm new at this and have been going through the tutorials but I just can't figure this one out. What I'm trying to do is...when you click on one of my menu buttons...say...'portfolio' it has a pop-up menu with 'option 1', 'option 2', and 'option 3'. Each option is a paragraph of text, which are separate php files. What I want is for all three paragraphs to show up if you click on the menu button and forget the pop-up menu. Right now I have display.php...which will be the page that will show up when you click 'portfolio' menu button (I think). If I click on 'option 1' it will show up as .../display.php?page=1...and bring up the paragraph I have on the 'option 1' php. I have this in an array but don't know how to put all three paragraphs together on the display page. I feel like I know the basic code but putting it all together is still very confusing. Could someone tell me exactly how they would do the code for this. If anyone can help...don't assume I know much of anything...*s*.Thanks.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

make the "portfolio" link an explode()-able link?

i.e. display.php?page=portfolio,1,2,3 or something...
leigh
Forum Newbie
Posts: 3
Joined: Mon Mar 13, 2006 8:51 pm

I'm new and need help with .../whatever.php?page=0

Post by leigh »

I'm not sure on how to write the arrays for all this...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

exploding $_GET['page'] on a comma will yield

Code: Select all

$show = array('portfolio','1','2','3');
I'm assuming you have the paragraphs stored in a single array. That makes display very simple

Code: Select all

foreach($show as $paragraphNumber)
{
  if(isset($paragraphs[$paragraphNumber]))
  {
    echo $paragraphs[$paragraphNumber];
  }
}
leigh
Forum Newbie
Posts: 3
Joined: Mon Mar 13, 2006 8:51 pm

Post by leigh »

It all makes sense when someone does it for me...thanks so much
Post Reply