Hiya,
Is this:
function unset_sessions()
{
//All Sessions on the script ....
UNSET($_SESSION['registration_form_display']);
UNSET($_SESSION['registration_form_button_clicked']);
UNSET($_SESSION['domain']); //Form Input
UNSET($_SESSION['domain_email_account']); //Form Input
UNSET($_SESSION['domain_email']); //Form Input
UNSET($_SESSION['password']); //Form Input
UNSET($_SESSION['errors']); Displays errors underneath the form.
echo __LINE__; echo '<br>';//DELETE
}
unset_sessions();
the exact same as this:
session_destroy();
I ask, because sometimes the 1st one fails to unset or NULL the values of some sessions such as this:
$_SESSION['registration_form_display
And I have to destroy session. Shall I opt to destroy the sessions instead to wipe-out displaying on form previous form inputs ?
Why I created sessions for user inputs.
Let's say user filled-in 2 form fields correctly and missed 1 or input is wrong on one. When they hit the SUBMIT button, script displays errors and indicates what the error is on which particular field. But only after page reloads on submit button click.
So, if form not filled properly and submit button is clicked then form is reloaded on screen for user to correctly fill-in form before trying to submit again.
As for those fields filled correctly, clicking the submit button would delete the inputs and so I dump the inputs to the sessions and then on page load (after clicking submit button) I repopulate the input fields with their previously correct inputs.
That's why I use sessions on forms.
And yes, I do not dump passwords onto sessions or cookies.