PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 29th, 2000, 03:44 AM
Antony Booth Antony Booth is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 6 Antony Booth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #2  
Old April 29th, 2000, 04:03 AM
ranjeet ranjeet is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Location: thane
Posts: 50 ranjeet User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to ranjeet Send a message via Yahoo to ranjeet
hi anthony
wht kinda appl u r developing?

wht do ya mean by multiform?


Reply With Quote
  #3  
Old April 29th, 2000, 06:15 AM
Antony Booth Antony Booth is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 6 Antony Booth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #4  
Old April 29th, 2000, 06:47 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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

Reply With Quote
  #5  
Old April 29th, 2000, 07:42 AM
Antony Booth Antony Booth is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 6 Antony Booth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #6  
Old April 29th, 2000, 08:07 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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).]

Reply With Quote
  #7  
Old April 29th, 2000, 08:15 AM
Antony Booth Antony Booth is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 6 Antony Booth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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>";

?>

----------

Reply With Quote
  #8  
Old April 29th, 2000, 08:24 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
<?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

Reply With Quote
  #9  
Old April 29th, 2000, 08:28 AM
Antony Booth Antony Booth is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 6 Antony Booth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i think the best response to that is:
oops

thanks
Shiju

Reply With Quote
  #10  
Old April 29th, 2000, 08:30 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
All The Best Antony!!!


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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Multiple Forms

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap