Forum Moderators: coopster

Message Too Old, No Replies

PHP Question

Multiple forms but kept seperate

         

cputek2k

4:22 pm on May 20, 2005 (gmt 0)

10+ Year Member



I am trying to create a page that asks the user to select certain things they want to do. Each item will take them to a form with that specific task.

Once that form has been entered, I want the next form to be available for data. and so on.

The problem I am having is getting the first form to be independant of the second form.

Any suggestions?

Sarah Atkinson

4:33 pm on May 20, 2005 (gmt 0)

10+ Year Member



I think I have a situation similar to yours

mine goes like this

person does a query on a DB for menus for a ranges or dates(yep I'm still on my menu thing) the person can then sellect via check boxes the days the want to edit sending them to another pages with a form for each day the current info is inserted for them into the fields(one field for each field in the db and one form for each row), they change what they want to change and then hit a single submit button. the submit action then changes "Updates" each database entry.

Is this kinda what you are going for?

Sarah

cputek2k

4:42 pm on May 20, 2005 (gmt 0)

10+ Year Member



Yes... sort of...

Specifically.. I am charged with creating a form that offers the user 6 (currently) options. To add, change, remove two seperate items. This does not connect to a database but does send an email to me.

I want the user to be able to select everything they want to do from the first page, the systematically do the tasks. For instance, if they want to add an item to the first form and change an item in the second one. They should be able to select the options that they want, click a "start" button. Then have a page generated to request the required information from the first form and then the second form. Then when the users submitts that data, it will verify and send the email.

The problem I am having is getting both forms to be seperate entities. If the user enters the data for one form then hits the submitt button, the form is sent and the other form is left out. If they do go back and fill in the other form, it resends the first email.

Sarah Atkinson

5:25 pm on May 20, 2005 (gmt 0)

10+ Year Member



What aboult having the forms data (without form tags or submit button)

as includes.

then have the includes within If()
then have something like this(in real code instead of phudo code)

<form>
if(check box2 = true)
include form2

if(check box3 = true)
include form3

if(check box4 = true)
include form4

<submit button>
</form>

if you look closly you may be able to do your if statments in a while( ) with the numbers incrementing. you may have to do some string and array work maybe implode [us3.php.net]or explode [us3.php.net] them. And carefully name your files and checkbox names. add those into a numeric array or something.

Sarah

cputek2k

6:07 pm on May 20, 2005 (gmt 0)

10+ Year Member



I've tried that... It still only does the one form. I will have to research your second suggestion. that may work....

Sarah Atkinson

6:18 pm on May 20, 2005 (gmt 0)

10+ Year Member



you have one submit button right?

do all the forms have the same action?

and all your included forms do not have <form> tags?

and do they all have differnt names on their fields?

cputek2k

6:29 pm on May 20, 2005 (gmt 0)

10+ Year Member



That could be the problem... I don't usually name my forms... I will try that.. Thanks for the second set of eyes...

leadegroot

6:23 am on May 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if you include the data entered in the form before the current one as hidden fields then the form after this one will be able to see the form before this one, and you will be able to keep track of what you are up to.

cputek2k

6:27 pm on May 23, 2005 (gmt 0)

10+ Year Member



Ok... I got part of it to work...

Now for the second and most important part.

If FormA is filled out but not FormB, can I get php to remove the instance of FormA without doing anything to FormB...

Not sure I am explaining that correctly...

FormA
FormB
Submitt

If user fills out FormA and hits submit, FormA sends an email with data. The same is true for FormB. I want to idiot proof this form. ie... If the user doesn't fill out FormA, the email is sent but destroys that form and only FormB is left.

Make any sense....?