How do I store these form input values into Sessions Variables?

Hello,

When a user submits a form but is asked to press the back button (because they entered the captcha wrong or forgot to enter a field), I would like to store the input variables into Sessions so that the information is not lost and it will reappear in the form without having to type it all in again.

I have 5 images that people can upload from their computer. I would like to store the file path into a session variable and plug it back into the input field if they have to return to the form.

Can someone provide me with the code to properly do this?

Here is part of my form:

Image 1: <input id="image1" type="file" name="file[]" value="<?php echo $negotiate_image1 ?>" />
Image 2: <input id="image2" type="file" name="file[]" value="<?php echo $negotiate_image2 ?>" />
Image 3: <input id="image3" type="file" name="file[]" value="<?php echo $negotiate_image3 ?>" />
Image 4: <input id="image4" type="file" name="file[]" value="<?php echo $negotiate_image4 ?>" />
Image 5: <input id="image5" type="file" name="file[]" value="<?php echo $negotiate_image5 ?>" />

Thanks

You cannot preassign the value of a file input.

I think a better way of handling this is just using the $_POST variables.

Your form just needs to post to itself to get $_POST

Maybe try see here,seem a similar reference:

http://apptools.com/phptools/forms/forms5.php

Ked :slight_smile:

$_Session[‘variable’] = $variable

http://php.net/manual/en/features.sessions.php