Page 1 of 1

send a variable through GET [Solved]

Posted: Wed Sep 19, 2007 11:01 am
by manurevah
hello,

i've been looking for a way to send a php variable from one page to another, normally with a simple link like (in a UDT):

Code: Select all

echo "<a href=\"/index.php/popcarte.php?id=$id\">Afficher sur la carte</a>";
of course this doesn't work with cmsms, i get a nice 404, is there a way to do this correctly ?

otherwise is there a way to use POST to send the variable without using a form ?

Re: send a variable through GET

Posted: Wed Sep 19, 2007 1:03 pm
by calguy1000
sending a variable through get works, you're URL is just wrong.

Code: Select all

<a href="index.php?var=value&var2=value2">blah blah blah</a>
also, don't use $id it's used internally and will mess up a bunch of stuff.

Re: send a variable through GET

Posted: Wed Sep 19, 2007 1:24 pm
by manurevah
the thing is that if i put a link like:

Code: Select all

index.php?var=value
then it sends me to the index page, i need to the link to point to a page, for exemple map.php with a variable 'var' . ..

just another thing, maybe this is not compatible/possible with the internal pretty url system ?

Re: send a variable through GET

Posted: Wed Sep 19, 2007 1:39 pm
by alby
manurevah wrote: the thing is that if i put a link like:

Code: Select all

index.php?var=value
then it sends me to the index page, i need to the link to point to a page, for exemple map.php with a variable 'var' . ..

just another thing, maybe this is not compatible/possible with the internal pretty url system ?
To go homepage because is home the default page.
For internal page use (see your $config['query_var'] = 'page'; in config.php)
..../index.php?page=AliasOfYourPage&var=value

Alby

Re: send a variable through GET

Posted: Wed Sep 19, 2007 2:06 pm
by manurevah
i de-activated pretty urls and adjusted my stuff. 

i started grumbling and then realized i needed to rereread.. 
: ]

but then it does come down to the fact that GET and pretty urls are a "no go"  . .. .    or is their a way ?

in all cases, thank you both for i think i'm getting this thing to work.. . yay.  \o/

Re: send a variable through GET

Posted: Wed Sep 19, 2007 2:23 pm
by calguy1000
You shouldn't have to disable pretty urls.... as alby said, you can still generate a url like
index.php?page=blah&var1=value1&var2=value2 inside one of your pages, and it will still work, it's just that the url is a bit uglier.  your navigation, etc, can still use pretty urls.

Re: send a variable through GET

Posted: Wed Sep 19, 2007 2:28 pm
by alby
manurevah wrote: i de-activated pretty urls and adjusted my stuff. 

i started grumbling and then realized i needed to rereread.. 
: ]

but then it does come down to the fact that GET and pretty urls are a "no go"  . .. .    or is their a way ?

in all cases, thank you both for i think i'm getting this thing to work.. . yay.  \o/
Calguy1000 is a rocket man  :D

Alby

Re: send a variable through GET

Posted: Wed Sep 19, 2007 3:13 pm
by manurevah
\o/

after changing everything to work with non pretty urls, everything *works* *
after reading your replies i put back pretty urls and all still works
i just understood something today, a few actually,
thanks mucho to both of you..  .  : ]

if interested, thanks to *  http://nogentcity.com/
and the concerned pages are "Nogent by Liste" and "Nogent by Carte"  (Alby this is not the MLE one)