PDA

View Full Version : restoring value of check box when move to next page



Anjali
08 Jun 2011, 04:47 AM
I have to navigate between two php pages. In the first page user has to select some value from check-box, and move to next page. when he comes back to previous page, that select value should be visible(currently it gets refreshed). We are not using any database to save values.

Need some solution to save selected value of previous page temperorily.

rusho_shaw
08 Jun 2011, 05:43 AM
Hi,
You can try saving the value using session.
In your first page put a clause like:-
if(isset($_SESSION['boxVal'])){
echo "//have the checbox with value as the selected value";
}
else{
echo "//have the checkbox without any value selected";
}

In your other page set the value of $_SESSION['boxVal'] as the selected value

Well I don't know whether this is the best approach, but it certainly is effective.

Thank You
Regards
Rusho Shaw