Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with variable persistence

Status
Not open for further replies.

shrubble

MIS
Joined
Jul 23, 2003
Messages
300
Location
US
I'm writing a survey in which the person taking it may need to jump out to another page (via link), and then jump back in to resume to continue where he or she left off.

My questions are this:
Can I simply use <?php echo &quot;$whatever&quot;> tags (or $_GET('$whatever') for that matter) to put the values already entered by the person back into the page? Should I use a session?

The issue is that if a person jumps away, I don't want them to lose what they have already entered.

Also, If the values that the person has chosen are in dropdowns, how do I reload the dropdown to reflect the persons choice? I'm sure this is an easy one, but I've never had to do it before, so I dunno.

Thanks!

deletion mistake
no I can't recover that
you didn't save it

-Shrubble
 
You must use session variabls. $_GET and $_POST are only available to a script for the single time it is run when input is submitted.

On pre-selecting elements of a <select> tag: When you're outputting the <option> tags for a particular question's possible answers, set the &quot;selected&quot; attribute for that <option>..</option> tag that represents a previous answer.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Thanks!

Is there an easy way to mark a selection as &quot;selected&quot;, or do I need to write a script that will generate the entire dropdown from scratch, with the appropriate item selected?

I already have an HTML form that I'd like to use (long story), and am wondering If there is a simple way to insert the proper &quot;selected&quot; without drastically changing the forms layout.

deletion mistake
no I can't recover that
you didn't save it

-Shrubble
 
You're going to have to programmatically insert the &quot;selected&quot; tag in the right place.

You're going to have to make some changes to the way the forms operate in order to make it easer to programmatically generate the appropriate &quot;selected&quot; tags.

I would strip out the questions and possible answers for each question into statically-defined arrays. Then have PHP loop through the data, outputting as appropriate.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Yeah, I was afraid of that...

Is there a forum in here to whine about implementing other peoples ridiculous ideas within a totally unnrealistic deadline?

Just kidding!

Thanks again


deletion mistake
no I can't recover that
you didn't save it

-Shrubble
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top