Forum OpenACS Q&A: Response to ns_returnredirect FORM vars vs URL vars

Collapse
Posted by Robert Ezman on
I'm guessing that what you want to do is process form vars from a previous page then decide what you want to do with them and redirect accordingly.

That's no problem...Imagine that your previous page has a form with var "formvar1"...in your redirect/processing page you'll do the following:

set formvar1 [ns_queryget "formvar1"]

#now of course you could use the ad utils for setting vars

#now do your processing

if { option1 } {

  ns_returnredirect "nextpage.adp?fromvar1=$formvar1&othervar1=$othervar"

#note the above is supposed to be one line

} else {

ns_returnredirect "otherpage.adp?formvar1=$formvar1"
}

If you want to create a link that passes stuff along:

<a href="nextpage.adp?formvar1=formvar">Add to cart</a>

#don't forget to escape the quotes

If you want to pass stuff from a previous form into a new form

<form ...>
<input type=hidden name=formvar1 value="$formvar1">
...
</form>

So you have three choices:

1) automatically redirect if you don't need user input...

2) pass info along in another form if you can have the user push a button

3) encode the form info into a link and have the user click on the link

Hope this helps.