Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP QueryStrings

Status
Not open for further replies.

Krus1972

Programmer
Mar 18, 2004
145
US
My index.php homepage has several links on it that when each link is clicked the link sends the following URL / querystring to my index.php page in the following formats:

link 1: link 2:
There is not a seperate directory for the server to switch to for each of the. The index.php page is requesting the information found between the "/" and processing it accordingly. This is all fine.

I am trying to figure out where the script determines if there is information between "/" in the URL or QueryString as shown in the above examples.

Can someone provide me with a short IF THEN PHP script that will demonstrate how to determine if information is
presenet between the "/" as it is in my script?

Thanks so much
 
To do it that way, your web server would have be be set up to perform url mod rewrites to send a url like that to a specific web page, and then have the PHP script get the URL, and parse out the information it needs.

Other than to have nicer looking urls I see no real practicality in doing it this way.

Once the PHP script gets hold of the URL there are different methods that can be used to get the information out of the url: Regular Expressions, substrings, even exploding the url into an array.

for example:
Code:
$pieces=explode("\",$url);

if($pieces[4]=="some information I'm looking for"){
do something.
}

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
My Server does not like the syntex:

$pieces=explode("\",$url);

Any other ideas?
 
The Parse_Url isn't in the script either :( .
 
My Server does not like the syntex:

$pieces=explode("\",$url);

What doesn't it like does it spit out an error? What does it say?

Obviously the $url variable in my example isn't populated by itself. How are you getting the URL into a variable?

Or what exactly is it that you want? What do you mean it isn't in the script?






----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top