Jump to content

Recommended Posts

Is there a code so if the page is index.php?page=Home it says Hi and if the page is index.php?page=Events it says Hello, or something like that, but the code HAS to be in index.php. Lots of Thanks.

 

im not that pro in PHP but i think the code has to look something like

 

<?php
$?=?("?");
if ($?=="index.php?page=Home")
  echo "Hi"; 
elseif ($d=="index.php?page=Events")
  echo "Hello"; 
?>

Link to comment
https://forums.phpfreaks.com/topic/92752-need-help/
Share on other sites

btw i want both the default page, index.php, and index.php?view=Home to say Home

 

<?php
$page = strtolower($_GET['page']);
switch ($page)
{
     case 'home':
          print 'Home';
     break;
     case 'events':
          print 'Events';
     break;
     case 'employment':
          print 'Employment';
     break;
     case 'gallery':
          print 'Gallery';
     break;
     case 'djs':
          print 'DJs';
     break;
     case 'vip':
          print 'VIP';
     break;
     case 'forum':
          print 'Forum';
     break;
     case 'contact':
          print 'Contact';
     break;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/92752-need-help/#findComment-475437
Share on other sites

try this

 

<?php
$getlink = $_GET["link"];

if ($getlink == "page1") {
echo "Hello This Is Page 1";
}
elseif ($getlink == "page2") {
echo "Welcome To Page 2";
}
else {
echo "Ooops! Page Not Found";
}
?>

 

so its like ?link=page1

 

and the out put is

"hello this is page 1"

Link to comment
https://forums.phpfreaks.com/topic/92752-need-help/#findComment-475443
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.