Forum Moderators: coopster
I have a 20 field form that I'd like to break down into 4 "pages" for a better user experience. I've been advised that PHP is the way to go.
I've searched the web for days trying to find software that...
1) can build a multi-page form
2) the form is not hosted on another site
3) I can own the software not pay by the month
4) can handle "if" scenarios, as in if client picks "A" then they get different fields than if they pick "B"
5) Doesn't charge extra fees for extra sites
Well I can't find it anywhere. So apparently this is a pretty tall order. Any ideas?
Please sticky me if you have a particular option to recommend so as not to go astray of the TOS.
Many thanks.
First, the easiest is putting it into hidden input:
<form action="index.html" method="POST">
<input type="hidden" name="a1" id="a1" value="<?PHP echo $_POST["a1"];?>">
</form>
second you can start session and store the variables there
third you can store the variables in a databasefill in form
I don't know about any free scripts that do things you mentioned.
Best wishes!
Michal Cibor
I don't mind learning PHP but I thought that maybe just buying some form maker software would be faster.
I can write HTML and I usually use Dreamweaver to design. Maybe I am just imagining that this would be more difficult to do by hand than it really is.
From what I understand so far, basically I just need to design 4 forms (in HTML?) and then use the PHP to save the filled in information and send it to the next form, then have the last form actually "submit"
I guess my challenge is finding the code to do that.
For the code you posted, I assume "a1" would be the name of the form field? Then I'd have to make 1 line of that code for every form field that I'd like to pass on?
Looks like I'm going to have to buy me a PHP book. ;-)
Imagine it as ONE big form with 4 displays.
Page 1 will display its own form fields and also have hidden fields for all the form fields in pages 2,3, and 4.
Likewise with the other 3 pages: each will display its own form fields, and have hidden fields for each of the other pages' form fields.
All pages will have a common hidden field identifying which page it is. This can be called 'pagenum' and its value will be 1 for Page 1, 2 for Page 2, etc.
Typically, all forms have 'Save' (or 'Submit') and 'Cancel' options for the user. Since this is a multipage form, you'll also need 'Next' and 'Previous' options.
Your page will be a PHP script. This script is the link to and the action page for your multipage form.
In a nutshell, the job of this script is to:
1. determine if the request is a form post or not, if not the first page will be displayed.
2. if a form post, determine which button the user clicked (save,cancel,next,previous) and take the appropriate action.
3. if cancel was clicked, redirect back to your starting page.
4. if save was clicked, validate, save the data, and then redirect back to your starting page.
5. if next or previous was clicked, OR the form didn't validate, OR the request wasn't a form post, determine which page needs to display based on the pagenum value and the button that was clicked.
6. output the form with the html for the chosen page number.
Hopefully this will get you started...
The first thing my script tests for is the third form submission, which will result in the display of my final screen and its form. Please note that the first three forms post to SELF, the final form will POST to a remote location. If the third form was submitted the final screen is displayed. If the test fails, then I test the 2rd form for a submit. If the test is good, I display the 3rd screen. Otherwise I continue thru the script and test the first form. Should each test fail then I must be on the first screen, so that is displayed to the user.
Pseudo-code might resemble this:
if Form 3 {
display Screen 4 and Form 4
if Form 4 (
POST to remote location and return to this script
from remote location.
}
}
else {
if Form 2 {
display Screen 3 and Form 3
}
else {
if Form 1 {
display Screen 2 and Form 2
}
else {
display Screen 1 and Form 1
}
You would be right to get a PHP book in your hands, and lurk around this forum and a few other respectable PHP sites on the web. I was into PHP for a couple of months before I could code a page like this. Your mileage might vary. In the end, what you want is not all that hard to do, and doing it yourself will reap more benefits than buying something off the shelf.
I knew this would be beyond my current skills so that is why I wanted to just buy some software...to get it up quickly. I think that if I just lurk and also find the right sites/forums I can piece this all together...eventually.
The other option (I guess) is to hire someone to do it for me. I'm pretty sure my current form is costing me money so it is an opportunity cost issue. How much do I lose by trying to figure it out myself vs. how much could I "save" by farming it out.
As far as getting a good book, is there a PHP for dummies or similar? The O'reilly books are good I know but just wondering if there are better options?
Anyway, again I really appreciate all of the help.
B
If you already have an understanding of HTML then PHP might not be *that* much of a leap. I did come into PHP with a programming background, and yes, that helped (or hindered?).