putting url parameter in array

J

Jeff

php 4.x

I'm developing a website and when the user clicks on a menu the code behind
the website have to update the url with new data... All parameters are in
the url... So I want the parameters in the url copied to an array wich I
update.

However I'm not sure whats the best way to access these parameters add put
them in an array I created.... I want the parameters copied to an array, and
this array should be designed so that I can access every item in the array
directly. for example like this:
$art = $params['articleid'] (the value of item articleid is copied over to
$art)

How should I access these parameters in url and get them placed in an array?
I've looked at $_server['query_string'] and $_server['http_host'] and I'm
NOT sure one of them are the correct one to use...
What do you recommend me to use?

Jeff
 
T

Toby Inkster

Jeff said:
How should I access these parameters in url and get them placed in an array?
I've looked at $_server['query_string'] and $_server['http_host'] and I'm
NOT sure one of them are the correct one to use...

I think you want $_GET.

On a page "test.php?foo=1&bar=2" then $_GET['foo'] will equal 1 and
$_GET['bar'] will equal 2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top