This topic is locked

html link to remember item and select that item in an application

12/5/2011 3:39:04 PM
PHPRunner General questions
ladykathleen author

OK I know this may seem a bit weird of a request for help on, I am thinking this should be simple but I am not sure how to do it.
I will start by explaining it.
I have a list of items all have an ID number.
I would like someone to be able to click on a link in that database list that would send them to (first login if not logged on or register if not registered) then once logged in still remember their selection and once on the submitting page it would automatically select the correct item in a dropdown selection.
I already have the dropdown selection and they can select it manually setup and the dropdown items are taken from the database list I want the add the link.
I have a feeling I may need to use a global variable but not sure how it would be done (with possible logging in issues)
Thank you in advance for any help
Kathleen

C
cgphp 12/5/2011

In the "Add page: before process" event (or "Edit page: before process" event) of the target page enter this code:

if( ! isset($_SESSION['UserID']))

{

$_SESSION['selection_id'] = $_GET['selection_id'];

header("Location: login_page.php");

exit();

}


Then, in the "After sucessful login" event check if the $_SESSION['selection_id'] is set:

if(isset($_SESSION['selection_id']))

{

header("Location: page_add.php?q=".$_SESSION['selection_id']); //or page_edit.php?q=".$_SESSION['selection_id']

exit();

}

//redirect the user to the items list if no session var is present

header("Location: page_list.php");

exit();
ladykathleen author 12/6/2011

I have not had time before now to check into this but wanted to say thank you for the input.
Part of the problem is the person looking at the list will never be on the add or edit page to start with.
They could be a guest or logged in person but they will be on a list page.
I can see where the 2nd part could work if the first part can be set up where they click a link from the first list page like they are make a selection for that item in the list.
Kathleen