Thread: Multiple Forms

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    6
    Rep Power
    0
    I am trying to setup a sort of multi form questionaire, but skipping forms dependant on a previous form's answers.
    I have tried a few methods but all seem to fail miserably
    Any ideas Please??
    TIA
    - Antony
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    thane
    Posts
    50
    Rep Power
    0
    hi anthony
    wht kinda appl u r developing?

    wht do ya mean by multiform?

  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    6
    Rep Power
    0
    My first form is a questionnaire set based on a customers details
    I then have an option of if they wish to enter their address

    if the option is true, bring up the address form, and then go to add_customer_to_database.php and add_address_to_database.php script

    if it is false go straight to the add_customer_to_database.php script
  6. #4
  7. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Antony,

    see you can solve this problem very easily.

    first you give the customer details form.End of the form give a check box or radio button for asking whether they want to enter their address.

    if it is true then ,
    first add_customer_to_database and then show the address form.after that you can pass the address infomation in add_address_to_database.php.

    if it is not correct then simply it will call add_customer_to_database.php3 and save all the customer details.

    eg:

    Custmer Details form
    <form action="add_customer_to_database.php3" method="post">
    Name : <input type=text>
    ---
    ---
    Do want to enter your address <input type="radio" name="address" value="want_enter">

    <input type="submit" value="submit" name="submit">
    </form>


    In add_customer_to_database.php3,

    <?php3
    if($submit=="submit"){
    if(isset($address)){
    #save the customer record in the database
    #then show the address form
    ?>
    <form action="add_address_to_database.php">

    </form>
    <?
    }else{
    #save the customer record
    #show the result page
    exit;
    }
    }
    ?>

    And in add_address_to_database.php just save the address of the customer and show the result page.


    This logic may help you for solving this problem.

    GOOD LUCK!!!








    ------------------
    SR -
    shiju.dreamcenter.net
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    6
    Rep Power
    0
    Thanks for the advice,
    but when I try that or use an include page
    the submit button on the second input form fails
    i click it and nothing happens, it doesnt go to the second action page
    shrug

    additionally, is there a sort of goto html page type command for when I have done everything?

    PS I am a newbie PHP and HTML programmer if you hadnt already guessed
  10. #6
  11. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Can i see your code.

    check whether submit button is inside the form tag.


    <form action="add_address_to_database.php" method="post">


    <input type="submit" name="submit" value="submit">
    </form>




    ------------------
    SR -
    shiju.dreamcenter.net

    [This message has been edited by Shiju Rajan (edited April 29, 2000).]
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    6
    Rep Power
    0
    the following post contains 4 files
    --------customer_input_form.html

    <FORM METHOD="POST" ACTION="/estate/add_customer.php">


    <HTML>
    <HEAD>
    <TITLE>Customer Information</TITLE>
    </HEAD>
    <BODY>
    <TABLE>
    <TR><TD><FONT COLOR="#FF0000">*</FONT></TD><TD>Forename</TD><TD><INPUT TYPE="text" NAME="customer[forename]" SIZE="20" TABINDEX="1"></TD></TR>
    <TR><TD><FONT COLOR="#FF0000">*</FONT></TD><TD>Surname</TD><TD><INPUT TYPE="text" NAME="customer[surname]" SIZE="40" TABINDEX="2"></TD></TR>
    <TR><TD><FONT COLOR="#FF0000">*</FONT></TD><TD>Email</TD><TD><INPUT TYPE="text" NAME="customer[email]" SIZE="60" TABINDEX="3"></TD></TR>
    <TR><TD></TD><TD>Fax</TD><TD><INPUT TYPE="text" NAME="customer[fax]" SIZE="60" TABINDEX="4"></TD></TR>
    <TR><TD></TD><TD>Phone</TD><TD><INPUT TYPE="text" NAME="customer[phone]" SIZE="60" TABINDEX="5"></TD></TR>
    <TR><TD></TD><TD>DOB</TD><TD><INPUT TYPE="text" NAME="customer[dob]" SIZE="60" TABINDEX="6"></TD></TR>
    <TR><TD><FONT COLOR="#FF0000">*</FONT></TD><TD>Password</TD><TD><INPUT TYPE="password" NAME="customer[password]" SIZE="16" TABINDEX="7"></TD></TR>
    <TR><TD><FONT COLOR="#FF0000">*</FONT></TD><TD>Confirm Password</TD><TD><INPUT TYPE="password" NAME="customer[confirmpassword]" SIZE="16" TABINDEX="8"></TD></TR>
    <TR><TD></TD><TD>Do you wish to enter your <BR> address at this stage?</TD><TD><INPUT TYPE="checkbox" NAME="addressinput" VALUE="y" CHECKED></TD></TR>
    <TR><TD></TD><TD><INPUT TYPE="reset" VALUE="Clear Form"></TD><TD><INPUT TYPE="submit" VALUE="Submit Information" NAME="SubmitCustomer"></TD></TR>
    <TR><TD></TD><TD><FONT COLOR="#FF0000">* is required information.</FONT></TD></TR>
    </TABLE>
    </FORM>

    --------- add_customer.php ----------
    <?PHP
    if ($SubmitCustomer=="Submit Information"){
    if ($addressinput){
    ?>
    <FORM METHOD="POST" ACTION="add_address.php">
    </FORM>
    <TABLE>
    <TD></TD><TD>Flat Number</TD><TD><INPUT TYPE="text" NAME="address[flat]" SIZE="4" TABINDEX="9"></TD></TR>
    <TR><TD></TD><TD>House Number</TD><TD><INPUT TYPE="text" NAME="address[house]" SIZE="4" TABINDEX="10"></TD></TR>
    <TR><TD></TD><TD>House Name</TD><TD><INPUT TYPE="text" NAME="address[name]" SIZE="40" TABINDEX="11"></TD></TR>
    <TR><TD></TD><TD>Street</TD><TD><INPUT TYPE="text" NAME="address[street]" SIZE="40" TABINDEX="12"></TD></TR>
    <TR><TD></TD><TD>District</TD><TD><INPUT TYPE="text" NAME="address[district]" SIZE="40" TABINDEX="13"></TD></TR>
    <TR><TD></TD><TD>City</TD><TD><INPUT TYPE="text" NAME="address[city]" SIZE="40" TABINDEX="14"></TD></TR>
    <TR><TD></TD><TD>County / State</TD><TD><INPUT TYPE="text" NAME="address[county]" SIZE="40" TABINDEX="15"></TD></TR>
    <TR><TD></TD><TD>Post/Zip code</TD><TD><INPUT TYPE="text" NAME="address[postcode]" SIZE="10" TABINDEX="16"></TD></TR>
    <TR><TD></TD><TD>Country</TD><TD><INPUT TYPE="text" NAME="address[country]" SIZE="30" TABINDEX="17"></TD></TR>
    <TR><TD></TD><TD><INPUT TYPE="reset" VALUE="Clear Form"></TD><TD><INPUT TYPE="submit" VALUE="Submit Address" NAME="SubmitAddress"></TD></TR>
    <TR><TD></TD><TD><FONT COLOR="#FF0000">* is required information.</FONT></TD></TR>
    </TABLE>
    </FORM>
    <?
    }
    else
    {
    print "customer forename: $customer[forename]<BR>";
    print "customer surname: $customer[surname]<BR>";
    print "customer email: $customer[email]<BR>";
    print "customer fax: $customer[fax]<BR>";
    print "customer phone: $customer[phone]<BR>";
    print "customer dob: $customer[dob]<BR>";
    print "customer password: $customer[password]<BR>";
    print "customer confirmpassword: $customer[confirmpassword]<BR>";
    exit;
    }
    }
    ?>

    -------- add_address.php -----------
    <?PHP
    echo "Add address data now";
    print "address flat: $address[flat]<BR>";
    print "address house: $address[house]<BR>";
    print "address house name: $address[name]<BR>";
    print "address street: $address[street]<BR>";
    print "address district: $address[district]<BR>";
    print "address city: $address[city]<BR>";
    print "address county: $address[county]<BR>";
    print "address postcode: $address[postcode]<BR>";
    print "address country: $address[country]<BR>";

    ?>

    ----------
  14. #8
  15. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    <?PHP
    if ($SubmitCustomer=="Submit Information"){
    if ($addressinput){
    ?>
    <FORM METHOD="POST" ACTION="add_address.php">
    </FORM>
    you made a mistake here(one extra </form> is their).

    try the following..


    <?PHP
    if ($SubmitCustomer=="Submit Information"){
    if (isset($addressinput)){
    ?>
    <FORM METHOD="POST" ACTION="add_address.php">
    <TABLE>
    <TD></TD><TD>Flat Number</TD><TD><INPUT TYPE="text" NAME="address[flat]" SIZE="4" TABINDEX="9"></TD></TR>
    <TR><TD></TD><TD>House Number</TD><TD><INPUT TYPE="text" NAME="address[house]" SIZE="4" TABINDEX="10"></TD></TR>
    <TR><TD></TD><TD>House Name</TD><TD><INPUT TYPE="text" NAME="address[name]" SIZE="40" TABINDEX="11"></TD></TR>
    <TR><TD></TD><TD>Street</TD><TD><INPUT TYPE="text" NAME="address[street]" SIZE="40" TABINDEX="12"></TD></TR>
    <TR><TD></TD><TD>District</TD><TD><INPUT TYPE="text" NAME="address[district]" SIZE="40" TABINDEX="13"></TD></TR>
    <TR><TD></TD><TD>City</TD><TD><INPUT TYPE="text" NAME="address[city]" SIZE="40" TABINDEX="14"></TD></TR>
    <TR><TD></TD><TD>County / State</TD><TD><INPUT TYPE="text" NAME="address[county]" SIZE="40" TABINDEX="15"></TD></TR>
    <TR><TD></TD><TD>Post/Zip code</TD><TD><INPUT TYPE="text" NAME="address[postcode]" SIZE="10" TABINDEX="16"></TD></TR>
    <TR><TD></TD><TD>Country</TD><TD><INPUT TYPE="text" NAME="address[country]" SIZE="30" TABINDEX="17"></TD></TR>
    <TR><TD></TD><TD><INPUT TYPE="reset" VALUE="Clear Form"></TD><TD><INPUT TYPE="submit" VALUE="Submit Address" NAME="SubmitAddress"></TD></TR>
    <TR><TD></TD><TD><FONT COLOR="#FF0000">* is required information.</FONT></TD></TR>
    </TABLE>
    </FORM>



    ------------------
    SR -
    shiju.dreamcenter.net
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    6
    Rep Power
    0
    i think the best response to that is:
    oops

    thanks
    Shiju
  18. #10
  19. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    All The Best Antony!!!


    ------------------
    SR -
    shiju.dreamcenter.net

Similar Threads

  1. Multiple choice, multiple page forms
    By Iswd1 in forum PHP Development
    Replies: 1
    Last Post: February 3rd, 2004, 04:43 PM
  2. winsock with multiple forms
    By collegegirly in forum Visual Basic Programming
    Replies: 2
    Last Post: January 13th, 2004, 03:05 PM
  3. Multiple forms (file upload+textarea): one is erased
    By Reks in forum PHP Development
    Replies: 2
    Last Post: December 29th, 2003, 11:12 AM
  4. PHP forms with multiple actions
    By Unity in forum PHP Development
    Replies: 0
    Last Post: November 28th, 2003, 02:48 PM
  5. jsp using multiple forms
    By stoutr5 in forum Java Help
    Replies: 2
    Last Post: October 2nd, 2003, 08:32 PM

IMN logo majestic logo threadwatch logo seochat tools logo