Jump to content
Sign in to follow this  
gmz1023

Php Multiple Pages Per One File

Recommended Posts

Hey y'all,i'm working on a website right now and i have a quick question about PHP.so lets say i have a code like thisCODE<?php$cmd = $_GET['cmd'];switch($cmd){case "page1":@include('page1.php');break;case "page2":@include('page2.php');break;case "page3":@include('page3.php');break;}?>and i want to make it so that instead of having to program the codes for the websites in manually it would just go off of the link it self, how would i do that?

Share this post


Link to post
Share on other sites
$cmd = some_sanitize_function($_GET['cmd']);include($cmd.php);

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...