Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-02-23 16:36:38
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
$POST values after cliking on href link
Hi I have a form where you select TYPE & OPTION.
Then you are redirected to a page that shows you the results acoding to the TYPE and OPTION you selected before.
The problem is that I cant reach the $POST values after clicking on a link that its outside the FORM in that same page.
Is there any way to keep the $POST values even if its after clicking on a link in that page?
Offline
Re: $POST values after cliking on href link
I think that adi_gps should do the job for you. It gets variables from the URL, including those posted from an HTML form as “name=value” pairs.
If you combined it with smd_query
then you get a lot of power – I am working on a site that allows registered users to post to the database from the front-end.
Offline
#3 2010-02-23 22:27:33
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: $POST values after cliking on href link
Thanks Anura,
The thing is I am not using URL variables.
I am using smd_query wich is great, but the thing is that the $POST I am getting from the form, is used in one page, but when someone clicks on a link in that page, and the new page is loaded I loose that $POST
Not sure why….
I need to find out a way to keep that $POST info from the form without using SESSION
not sure if its posible.
or if I am doing something wrong.
Offline
Re: $POST values after cliking on href link
mlarino wrote:
the $POST I am getting from the form, is used in one page, but when someone clicks on a link in that page, and the new page is loaded I loose that $POST
Not sure why….
Because that’s how $_POST
works. If you don’t want to use a session you’ll need to use another form on the intermediate page, using hidden inputs to pass along the $_POST
data. If it needs to be a link instead of a submit button you could javascript it:
<a href="#" onclick="document.forms['myForm'].submit()">
also including a submit button in a noscript
in case javascript is disabled.
Code is topiary
Offline
#5 2010-02-23 23:30:07
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: $POST values after cliking on href link
Thanks Jeff!
That solution seems to be the perfect one!
but I just tested it, and I had no luck!
The $POST is lost even using that JS…
I am using it like this:
on “page 1” there is a Form that lands on “page 2”
on “page 2” the form is still visible with the selected fields, and the results are counted and the numbers of each article type printed on a map.
<area shape="poly" title="" alt="<txp:smd_query query="SELECT count(*) as cantidad FROM textpattern WHERE Section LIKE '%?opcion%' AND custom_1 LIKE '%?tipo%' AND custom_6='oleiros' " > {cantidad}
</txp:smd_query> inmuebles" coords="376,19,382,19,385,16,391,16,394,11,400,14,401,9,410,8,418,11,428,6,433,14,437,14,440,21,438,28,439,33,429,38,426,50,420,57,418,81,427,108,427,134,435,161,431,159,407,172,388,172,376,168,365,159,366,148,363,143,358,143,352,137,350,130,345,127,340,127,338,120,340,117,335,111,346,113,347,107,352,107,357,110,363,110,374,100,378,100,379,96,377,92,380,89,374,87,381,76,380,70,390,67,382,64,383,59,389,58,390,48,386,43,381,43,376,47,370,47,369,41,373,38,376,35,374,31,381,30,383,26,377,25,375,20" class="" href="oleiros" onclick="document.forms['myForm'].submit()" />
The areas of the map are the links to show the articles found from each region.
the link takes you to “page 3” where I need the POST info from “page 1” to be able to make a query to extract those results as articles.
www.mlarino.com/asesoria/inmobiliaria
Offline
Re: $POST values after cliking on href link
The 'myForm'
needs to be the ID of the form.
Code is topiary
Offline
#7 2010-02-24 00:17:03
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: $POST values after cliking on href link
I know I know, they have the same ID and still doest work.
Offline
Re: $POST values after cliking on href link
I’m seeing this:
<a href="resultado-fichas">ver las 1</a>
for the text link.
Code is topiary
Offline
#9 2010-02-24 01:24:25
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: $POST values after cliking on href link
I am using the js you gave me in the AREA map of the image.
<area shape="poly" title="" alt="<txp:smd_query query="SELECT count(*) as cantidad FROM textpattern WHERE Section LIKE '%?opcion%' AND custom_1 LIKE '%?tipo%' AND custom_6='sada' " >{cantidad}
</txp:smd_query> inmuebles" coords="484,61,499,74,496,83,499,85,493,90,500,100,505,100,506,105,515,109,519,108,526,117,529,124,535,126,542,133,547,139,545,146,539,153,537,163,534,174,519,180,516,189,516,202,514,209,503,218,480,205,467,206,465,201,449,186,446,169,439,162,435,161,427,135,427,107,419,82,420,56,427,48,429,38,440,32,441,37,454,40,457,37,470,36,470,38,475,38,477,49,483,51" class="" href="sada" onclick="document.forms['buscador'].submit()" />
Offline
Re: $POST values after cliking on href link
And it seems to be working correctly for the one area
in which you have set href="#"
.
Code is topiary
Offline
#11 2010-02-24 02:45:10
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: $POST values after cliking on href link
Yes, only on that one.
But when it points to anyother page i loose the POST
Offline
Re: $POST values after cliking on href link
mlarino wrote:
But when it points to anyother page i loose the POST
Expected, really. You need to submit the form to the target page. If you don’t send and receive the data, it won’t come along. Other way is to store the data with sessions of your choise. The form itself won’t remember what was in it, how could it, it just can not.
Offline