Support

Need help with a tutorial? You may post in the tutorial topic itself so if other people are having the same problem they can find it quickly and easily!
All tutorials are copyright © by Faintmedia.com. You may not copy these tutorials.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

PHP basics part 2 A look at PHP Navigation Rate Topic: -----

#1 User is offline   Riley Wiebe 

  • Faintmedia CTO
  • Icon
  • View blog
  • Group: Admin
  • Posts: 209
  • Joined: 06-May 08
  • Gender:Male
  • Location:Canada
  • Creator of Faintmedia Raive Studios/Decade Creations Member Northern Storms Admin Creator of Led Salad Coffee Addict Most Posts Purchased 1 - 3 products Reported a bug

Posted 29 July 2008 - 09:58 AM

Tutorial Release Date: Saturday, March 11th, 2006
Note: This is only the release date for Decade Creations.com. This tutorial was released before this date. It is also the date of the new version of this tutorial, it should be easier to read and you should get the same results. It now includes an example file that you can download.

In this tutorial I will show you how to create your php page so that if the user goes to test.php?id=1 it will be a different page and if they went to a page like test.php?id=1)#=1 it will be a different page yet.

Okay we will start with the full script.

<?php
  // Variables
  $id = $_GET['id'];
  $lang = $_GET['lang'];
  
  // id = 1 and lang = 2
  if ($id == 1 && $lang == 1)
  {
       echo 'Plays out ?id=1&lang=1';
  }
  
  //ID = 1 and lang = 2
  if ($id == 1 && $lang == 2)
  {
       echo 'Plays out ?id=1&lang=2';
  }
  
  // ID equals 1
  if ($id == 1)
  {
       echo 'Plays out ?id=1';
  }
  
  // ID is empty
  if (!$id)
  {
       echo 'Nothing';
  }
  ?>


In the script above it will try and read it as: ?id=x&lang=y then it will go to just ?id=x and finally it will just go to the final one if nothing is entered.



<?php
   if ($id == 1 && $lang == 1)
  {
     	echo 'Plays out ?id=1&lang=1';
  }


This part of the script will say "Plays out ?id=1&lang=1" if you put page.php?id=1&lang=1

Now if you put page.php?id=1&lang=2 it would say "Plays out ?id=1&lang=2"

The other code is really simple. If id=1 it will just say "Plays out ?id=1"

and finally if you don't have anything entered it will just say "Nothing"

Like This Tutorial? Join the Community Today!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users