Jump to content


PHP Help Please?

  • This topic is locked This topic is locked
1 reply to this topic




  • Respected Member
  • 1982 posts
  • Gender:Male
  • Location:Unstalkable
  • IGN:WhamWaffle

Posted 08 August 2009 - 08:02 PM

Okay, I'm making a website, but how do I do the "?id=page" stuff? I forgot how already hehe.

I'm talking about something like this:

Posted Image
Whamwaffle - 3X Dawn Warrior - INACTIVE

Please support our sponsors and mapletip. Don't block ads if you want mapletip to survive! If you do not want to have ads, simply Subscribe to mapletip today!

#2 Adam~


    Dip me in chocolate and throw me to the lesbians.

  • MapleTip Contributor
  • 1276 posts
  • Location:Florida
  • IGN:Fallenkid

Posted 09 August 2009 - 02:40 AM

Haven't done PHP in a ages, so I'm not gonna go into like, ultra detail, but basically you need to create an array

$action = $_GET['act'];
$actions_array = array('forum','create','topic','reply','mod')

And then down the page where my content is I have an if statement saying if there is no action set

if(!$action || !in_array($action,$actions_array)){


to operate normally (with my boards showing like they should, because it's a forum)

and after that I have an else statement (duh) which tells the page what to do if an action is selected

                 if($action == 'forum'){
                     include "./inc/forum.php";

                 if($action == 'create'){
                     include "./inc/create.php";
                 if($action == 'topic'){
                     include "./inc/topic.php";

                 if($action == 'reply'){
                          header("Location: login.php");
                      }else {
                          include "./inc/reply.php";
                 if($action == 'mod'){
                          header("Location: index.php");
                      }else {
                          include "./inc/mod.php";

and obviously if a value in the array is selected it directs you to the corresponding page

It looks like this if I select topic (of course there's an id, but that's defined in the topic page itself)


And that's how I did it, but I dunno. I could have left something out since I did this last year and haven't looked at it at all. I don't even remember doing it, but this was when I first learned PHP. I just did a quick scan of it, so. I could've screwed something up, but get over it. Plus, it's 4:40 AM.

Somebody else would probably explain it alot better.

Posted Image
errybody is invited. just ask.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users