Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8080253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:21:32+00:00 2026-06-05T16:21:32+00:00

I saw some websites that (for example): if you want to view your message

  • 0

I saw some websites that (for example):
if you want to view your message box, then it is: example.com/file.php?action=pm and also if you want to send a message again the address and the file is the same, but the $_GET is different : example.com/file.php?action=sendpm

How does it work?

Is it just:

if ($_GET['action'] == "pm")
{
    //lots of html code(divs, forms, etc) paste here for action=pm.
}
else
{
    //lots of html code paste here for action=send
}

instead of having files : pm.php, send.php … ?Or the mechanism is different?

I saw that SMF use this mechanism and also I saw something like this for facebook.com/?ref=something.

How does it work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:21:33+00:00Added an answer on June 5, 2026 at 4:21 pm

    The easiest way is this:

    $action = isset($_GET['action']) ? $_GET['action'] : 'default';
    if(!in_array($action, array('list', 'of', 'allowed', 'pages')))
        $action = 'default';
    include($action . '.php');
    

    Note that the validation step is incredibly important. Not properly validating the value leads to nasty security holes from users being able to read any files your script can access to users being able to execute arbitrary code.

    Putting all code in a single file like you suggested in your question is a bad idea since it results in unreadable code. Especially when mixing PHP and HTML in the same file like your question suggested (tip: use a template engine!).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw some html that displays the results of a PHP code just by
I was writing a program, and then I saw this on some website that
I saw some scala code that assign _ to a field of class, what
EDIT: See my comment. Hello. I just saw that some (only some) flash files
I have just tried to save a simple *.rtf file with some websites and
I saw couples of weeks ago some notes in adobe AIR website that they
I want to access a custom attribute that I added to some elements in
On this website http://inspectelement.com/html5portfolio/ , I saw that he is using a float:left; command
I saw some code on the apple website that goes like this id <NSFetchedResultsSectionInfo>
I want to embed some HTML on my website... I would like that: SEO

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.