send a variable through GET [Solved]

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
manurevah
Forum Members
Forum Members
Posts: 37
Joined: Fri Aug 03, 2007 2:24 pm

send a variable through GET [Solved]

Post 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 ?
Last edited by manurevah on Wed Sep 19, 2007 3:59 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: send a variable through GET

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
manurevah
Forum Members
Forum Members
Posts: 37
Joined: Fri Aug 03, 2007 2:24 pm

Re: send a variable through GET

Post 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 ?
alby

Re: send a variable through GET

Post 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
manurevah
Forum Members
Forum Members
Posts: 37
Joined: Fri Aug 03, 2007 2:24 pm

Re: send a variable through GET

Post 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/
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: send a variable through GET

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
alby

Re: send a variable through GET

Post 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
manurevah
Forum Members
Forum Members
Posts: 37
Joined: Fri Aug 03, 2007 2:24 pm

Re: send a variable through GET

Post 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)
Post Reply

Return to “CMSMS Core”