Forum Moderators: coopster

Message Too Old, No Replies

Form Values getting reset

Form Values getting reset on submit

         

eatspinach

2:25 pm on Jun 17, 2009 (gmt 0)

10+ Year Member



Hi I have a php web form, that has another small web form inside it (a file upload box & button).

the problem i am having is that when the user upload the file all the other fields get reset or "cleared out" so this is a little frustrating for the user as they have to re enter everything again,

is their a way around this?

Thanks

jatar_k

3:19 pm on Jun 17, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



why are they getting reset? are you refreshing the page?

eatspinach

3:36 pm on Jun 17, 2009 (gmt 0)

10+ Year Member



Thanks for your reply
the page is survey-step2.php and i have both forms set up like,

<form enctype="multipart/form-data" action="survey-step2.php" method="POST">
<input type="hidden" name="AudioFile-1" value=""/>
Please choose a file: <input name="uploaded" type="file" />
<input type="submit" value="Upload" />
</form>

does this make sense is their a better way of doing it? should i post all my code?

mooger35

3:39 pm on Jun 17, 2009 (gmt 0)

10+ Year Member



when you submit either form the page is reloading and any information on the other form that has been added will be lost.

If it's just a file upload I would look into using an ajax file upload.

jatar_k

3:44 pm on Jun 17, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could also put it all in one form, then you could load the other data back into the respective elements

eatspinach

3:47 pm on Jun 17, 2009 (gmt 0)

10+ Year Member



both good suggestions, i have never heard of this ajax file upload i will give it a go as their seems to be a lot of demos on the net.. thanks again

eatspinach

9:21 am on Jun 18, 2009 (gmt 0)

10+ Year Member



Hooray I finally got it working, I tried a few different examples on the net but i found one the most useful, Thanks

[edited by: coopster at 11:25 am (utc) on June 18, 2009]
[edit reason] removed non-authoritative url [/edit]