Re: What is "app.php?ph=cus&id=4"?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 04, 2010 at 06:54:34AM -0700, Michael Calkins wrote:

> 
> I would google this but I have no idea what this method is or how it works.
> app.php?ph=cus&id=4
> Can some tell me what this either called or how it works?Can I get a tutorial for it please?

This is standard HTTP/HTML terminology, not unique to PHP. What is means
is that the script being executed (app.php) has been supplied two
parameters: "ph" and "id".

app.php is a script that can perform various functions, depending on the
parameters passed to it. For example, app.php may display a record from
a database. And in this case, app.php may be tasked to display a
customer record, and the customer record it should display is the one
where the customer number is 4.

Syntax-wise, after the name of the script (app.php), are whatever
parameters, if any, the script requires. The first question mark begins
the list of parameters. Each parameter normally will be in the form

parameter=value

In between each of these parameter/value pairs, you will find an
ampersand (&). So in this case, you have two parameters being passed.
The first is "ph", and its value is "cus". The second is "id" and its
value is "4". What these parameters mean exactly to the script depends
on the script. There's no universal guide for parameters, what they're
called or what their values can be. You'd have to look at the script
itself to see what the parameters make the script do.

In PHP, if you want to use these parameters, you would query the
parameters this way:

$page_type = $_GET['ph'];
$which_item = $_GET['id'];

If executed this way, you would find that $page_type has a value of
'cus', and $which_item = '4'.

You might have code inside app.php which would look like the following:

$type = $_GET['ph'];
$id = $_GET['id'];

if ($type == 'cus')
	show_customer_page($id);

Hope that helps.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux