News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Passing parameters

Started by osquitar, February 08, 2006, 05:09:26 PM

Previous topic - Next topic

osquitar

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?



Excuse me, I don't speak English well.

sm2k

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.

Advertisement: