what is php id? what does it let me do? does it let me put more than one page inside one file or something? If it does something like that, how do i use it? what is the code for it? Please help. I am sort of new to php.

PHP is a dynamic programming language. It, for example, generated the page that your are viewing now.

what is php id? what does it let me do? does it let me put more than one page inside one file or something? If it does something like that, how do i use it? what is the code for it? Please help. I am sort of new to php.

I hope this is the answer to your question.
These are variables passed along through the HTTP protocol. You can, like you are suggesting, display another page depending on the value this variable has. This variable doesn't necessarily need the name to be 'id'. It can be anything you choose.

I suggest you follow a PHP tutorial first. Or buy a good book. These things are explained in them.

thanks! So, basically it just a variable inside the PHP webpage? So can you put a whole page of HTML inside a variable? If that is so, Thats cool. I'll Try that.

visit RandomResources.org

thanks! So, basically it just a variable inside the PHP webpage? So can you put a whole page of HTML inside a variable? If that is so, Thats cool. I'll Try that.

visit RandomResources.org

No! You can not put a whole page of html inside a variable. You can just pass a variable that is used on 1 page to another page using the HTTP protocol.
You pass the variable by putting it behind the question mark (?) in the url.

Depending on the value of the variable, you could choose what to display using an "if" statement in PHP.

Think of a variable as a little bit of memory that you give a name, and you can store things in it.
for example:
If say, you wanted to make the php page show differnt things, depending on the variables in the URL, you could use the switch function to deal with them.
Say you use a switch that checks the $page variable. you can then make the page look different, depending on what the contents of the $page variable are.
The most obvious use might be page numbers. $page=1 $page=2 and so on.
using switch you could alter the pages contents like so:

switch ($page) {
 default:
$content = "main.html";
break;

case 1:
$content = "page1.html";
break;

case 2:
$content = "page2.html";
break
}

And so on.

You would then include in the main body of your page some code like this:

<?php include($content); ?>

So when you call in your browser the page index.php?page=1 as an example. the page index.php will load up as normal, but the body of the page will display the contents of page1.html.


Switch is just an example, as you can obviously use many other means to define what is displayed on a page and how.

Hope this helps :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.