Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-25-2006, 08:59 PM   PM User | #1
rmstvns
New to the CF scene

 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
rmstvns is an unknown quantity at this point
Continuous forms

I am trying to create a form that when submitted will then route to another form asking form more information. My questions is how shoudl those forms be linked? i.e. Form 1 asks for and id number, first name, and last name, the user clicks submit and the second form asks for an address. The address is saved in a separate table in the database but uses the same id number without asking for it.
rmstvns is offline   Reply With Quote
Old 11-25-2006, 09:33 PM   PM User | #2
CFMaBiSmAd
Senior Coder

 
CFMaBiSmAd's Avatar
 
Join Date: Oct 2006
Location: Denver, Colorado USA
Posts: 2,711
Thanks: 2
Thanked 251 Times in 243 Posts
CFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the rough
If you only have a small amount of data that needs to be passed between pages, using a hidden field in the form is a popular method. If you have a large amount of data, this should be kept on the server and passed between pages in session variables.
__________________
If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.
CFMaBiSmAd is offline   Reply With Quote
Old 11-26-2006, 03:00 AM   PM User | #3
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
With PHP, the first form has the name of the second form in the spot
for action: <form action="script2.php" method="post">

On the second script, you grab the variables from the first form.

<?php
$name=$_REQUEST['name'];
$id=$_REQUEST['id'];
?>
Then display the next form.

That 2nd form can call another script or you can call the final
PHP script that processes your form(s).

With PHP, variables are global, so as you move from script to script,
those variables ($name, $id, etc) will follow along. No need to send
them hidden or re-define them.
mlseim is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:24 PM.


Advertisement
Log in to turn off these ads.