Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: osquitar - helmikuu 08, 2006, 05:09:26 IP

Otsikko: Passing parameters
Kirjoitti: osquitar - helmikuu 08, 2006, 05:09:26 IP
I used to pass parameters with a link this way: /index.php?option=1&var1=2&var3=3 This does not work in SMF.

I wanted to show a result of MySQL query. When the page is shown, the user can make a click in a link and get the result of another MySQL query.

I am using tiny portal in SMF Forum. I want to build a php block. I think this is similar to php article.

Can you help me?



Otsikko: Re: Passing parameters
Kirjoitti: sm2k - helmikuu 09, 2006, 11:58:04 AP
Are you trying to get these variables in an SMF forum page, or just another page on your website?

In a php script, you can get the parameters passed to the script via query string using the following:

$option = intval($_GET['option']);
$var1 = intval($_GET['var1']);
...
etc

(intval isn't necessary, but guarantees integers and returns 0 on failure)

You have to explicity get your parameters this way if register_globals is turned off, which it should be.