Forum Moderators: coopster

Message Too Old, No Replies

Query Strings

How to use and implement query strings

         

Francis

6:56 pm on Mar 12, 2003 (gmt 0)

10+ Year Member



Sorry, I'm new and need some help on implimenting query strings. I need a single html file and what I want to happen is to dynamically insert the contents based on a selection. I hope this makes sense.

For example, I have a list of items that has question mark on the side for help. If the user clicks the question mark, it will open a pop-up window with the text (ang graphics) in it.

Is it possible to just create one template and pass the .html or text files to that template?

andreasfriedrich

7:28 pm on Mar 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com] Francis.

IŽd suggest reading Marcia`s WebmasterWorld Welcome and Guide to the Basics [webmasterworld.com] post which contains a lot of useful information.

In PHP [php.net] you can access the parameter passed in the query string via the $_GET [php.net] super global array. You could then include() [php.net] a file depending on the value of such a parameter. Be sure to check any user supplied data since it is inherently insecure. Unless PHP [php.net] runs in secure mode and/or you check the filename a user could use a value of /etc/passwd to retrieve your password file (if your script reads and echo() [php.net]s files whose filename is supplied by a query string argument).

Search for include() [php.net] on WebmasterWorld or follow the links to the PHP [php.net] manual.

HTH Andreas

Francis

7:44 pm on Mar 12, 2003 (gmt 0)

10+ Year Member



Thanks. Will do.