Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Back Button

Status
Not open for further replies.

kzn

MIS
Jan 28, 2005
209
GB
Hi

I need to set up something where by someone can post something and its done in three stages.

First page contains a form that requires some details. At the bottom of the page is a Next button that submits the form, this is submitted to the database and is redirected to the second page.

Second page contains a form and an upload page. At the bottom of the page is a Next button that submits the form to the database and redirects to the confirmation page, it also has a back button.

Third page is a confirmation of what has been inserted. It lists all the inputs and shows what files that have been uploaded. When the user click on complete it redirects and updates the database with it being complete from the hidden form field.


The back button is a hot topic on the net and I am not sure which is the best method to use. The problem.

When the "BROWSER" back button is clicked it comes up with an error and wants to resubmit the data, and when "my" back button is clicked it actually goes forward. I was thinking of holding the data that is submitted in a session so when the back button is clicked it is available. The files that are uploaded are normally large so I dont want to lose this and have the user to have to repost it.

Page one form:
<form action="post1.php" method="post">
TITLE <input type="text" name="title" /><br />
DESCRIPTION <textarea></textarea><br />
<input type="hidden" name="submitted" value="true" />
<INPUT TYPE="image" src="images/nextStep.png" width="174" height="33" alt="Step 1" />
</form>



Page two form:
<form action="post2.php" method="post" enctype='multipart/form-data'>
File to upload: <input type="file" name="upfile"><br />
Notes <textarea name="notes"></textarea><br />
<input type="hidden" name="submitted" value="true" />
<input type="image" onClick="history.go(-1);return true;" src="images/backStep.png" width="174" height="33" alt="Go back" />
<input type="image" src="images/nextStep.png" width="174" height="33" alt="Step 1" />
</form>


Page Three Confirmation:
<form action="post3.php" method="post">
Bla bla bla bla
<input type="hidden" name="complete" value="true" />
<input type="hidden" name="submitted" value="true" />
<input type="image" onClick="history.go(-1);return true;" src="images/backStep.png" width="174" height="33" alt="Go back" />
<input type="image" src="images/Complete.png" width="174" height="33" alt="Step 1" />
</form>

Any pointers appreciated. Thank you in advance.
 
All three screens are associated with a single record so the second and third will somehow need to know the record Id. Either by hidden field or by session variable. I prefer the latter.
Once you have the associability then back/forward is simply the same as editing a form. So load the form with prefilled data rather than blank values.
Better still use a multipage form plugin for jquery or roll your own that does not refresh the page but uploads field information over ajax and file uploads via iframe. Then the user can navigate back and forward through the form without any special interaction.
 
Thanks Jpadie, I will go with the session variable as you suggest. I would love to do Jquery and Ajax but that is beyond me for now. Thanks again.
 
Ajax in 30 seconds ... well near enough at any rate ...


Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top