Current location: Hot Scripts Forums » Programming Languages » PHP » Passing a value between forms


Passing a value between forms

Reply
  #1 (permalink)  
Old 10-07-03, 01:22 AM
lordmerlin lordmerlin is offline
Newbie Coder
 
Join Date: Jul 2003
Location: South Africa
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Question Passing a value between forms

I have a script, which contains three forms broken down with if statements, as follows:


if ($_GET['Step_3']) {
"Last Page"
} else ($_GET['Step_2']) {
"Second Page"
} else {
"Start Page"
}


Now, I have a random number that gets generated when the script loads, under the first page section, and I want to carry it through to the other three pages.

The submit button on each page is called Step_2 (on the first page), and Step_3 (on the second page). The last page will simply be a confirmation that everything has been submitted and went through sucessfully.

I tried adding the value, $tempid, as hidden field, but it doesn't seem to goto the second page.

Any ideas?
Reply With Quote
  #2 (permalink)  
Old 10-07-03, 05:43 AM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
Well, I hope you know that just putting in "Start page" isn't going to do anything, in fact it's going to yell at you.

Also, you may want to check the form method, if it's not set to GET it's not going to work, I would recommend using POST anyways.

Here's what I would do:
Setup your form tag like this:
<form name="steps" method="POST" action="yourscript.php?step=(next step here)">

If you need to, you can even set up a variable for the step part in that url and make take the current step and add one. The rest of the form values should be accessed with $_POST. Using the POST method in forms is not only much more secure, it's much nicer looking not having a ton of things in the URL.
__________________
PHP / mySQL Developer
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
passing values from one form to another -urgent aspuser25 ASP 1 09-19-03 06:41 PM
Trouble with parameter passing in URLs and str_replace crookyboy PHP 2 09-16-03 05:30 AM
passing values aspuser25 ASP 2 09-06-03 07:26 AM
Passing value from one form to another form sasi ASP 2 08-29-03 11:38 PM
Array passing between functions alfreds PHP 1 08-25-03 05:29 AM


All times are GMT -5. The time now is 06:34 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.