Jump to content

[SOLVED] To use a session variable


verdure

Recommended Posts

Hi ... i have the following scenario ... any suggestions on how to include the session variable will be greately appreciated.  :)

 

PAGE A : A list containing values of country names. Submit button

 

PAGE B : ----> This page contains a form with many fields.

 

-->The submitted value (country name)from PAGE A is put in a readonly text field.

-->The counties for the country selected are retrieved from  the database.

 

On clicking the submit button the form is validated by PAGE C. The error messages are sent back to PAGE B

 

Here is the problem ... when the error messages are displayed.

The value of the country field is not retained.

 

I realised i havent included the session variable that is why it is not happening.

Could some body please direct me with an example as to how to declare session variable.

 

 

Link to comment
Share on other sites

on page C have some logic that assigns the values sent from page B to a session variable IF errors existed.  when the user is sent back to page B have some more logic that will fill out the form using the variables stored in the session if the user was returned back to page B from page C.

Link to comment
Share on other sites

This is why I prefer to have any and all forms submit to themselves and have the processing done on the same page. It negates the need to transfer information back to the previous page.

 

In any case, for an introduction to sessions, I would suggest the examples in the manual: http://uk3.php.net/manual/en/session.examples.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.