Re: [PHP] passing variables from forms to the same page repetatively
This function that matt sent to automatically write hidden inputs is awesome. it works great. I am only using the first function. It's a great solution. thanks Original Message Follows From: maatt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [PHP] passing variables from forms to the same page repetatively Date: Tue, 17 Jul 2001 11:23:11 +0100 I was doing something similar just yesterday. Ended up with a little function to automatically write hidden inputs for every variable that's submitted, whether posted or thru the url. Goes like this... // put this somewhere in your form ?php print get_param_inputs(); ? // the function itself function get_param_inputs() { global $HTTP_GET_VARS, $HTTP_POST_VARS; $ret_str = ; $params = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS); foreach ($params as $k=$v) { if (is_array($v)) { foreach($v as $kk=$vv) { $ret_str .= 'input type=hidden name='.$k[$kk].' value='.$vv.''; } } else { $ret_str .= 'input type=hidden name='.$k.' value='.$v.''; } } return $ret_str; } I also needed to append the variables to links on the same page (for page 1, page 2, page 3... type thing) so did this: a href=?php print $PHP_SELF.get_param_query() ?link/a function get_param_query() { global $HTTP_GET_VARS, $HTTP_POST_VARS; $ret_str = ; $params = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS); $j = ?; foreach ($params as $k=$v) { if (is_array($v)) { foreach($v as $kk=$vv) { $ret_str .= $j.urlencode($k[$kk]=$vv); $j = ; } } else { $ret_str .= $j.urlencode($k=$v); $j = ; } } return $ret_str; } Won't work if you're nesting arrays within arrays, but I'm not a recursive type. Hope it helps, Matt David Robley [EMAIL PROTECTED] wrote in message 01071716134101.29979@www">news:01071716134101.29979@www... On Tue, 17 Jul 2001 15:41, Tim Olsen wrote: People, I have 4 forms in four seperate html pages included directly (no links to includes) in the same .php file, i have it so all the form actions is php.self, so when each form is submitted it goes on to display the next form in line, using if and else statements, of course. I want to be able to use variables created by the first form in the html part of the last form. What is the best way to do this? So far, I can only use variables on the next page (form) that is written out. After that those variables have no value. Is there some way to submit all variables present and assigned with the submission of each form? If I make the forms a seperate include file, instead of having them in-line, how does this change the ways variables are passed or submitted by each form? Thanks, - Tim _ If I understand what you are saying: those variables don't exist until you SUBMIT the form. You can demonstrate this by looping through and displaying your POST or GET vars at the beginning of the form and see what happens when you first open the page, and when it calls itself. And re-reading, I think what you may want is hidden fields. You want part one to call part 2, and retain values from part 1, etc? Echo the values into hidden fields in each step of the process. INPUT TYPE=hidden NAME=whatever VALUE=?php echo $whatever ? -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA I always lie. In fact, I'm lying to you right now! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] _ Get your FREE download of MSN Explorer at http://explorer.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] passing variables from forms to the same page repetatively
INPUT TYPE=HIDDEN NAME=name_of_variable VALUE=value_of_variable -Original Message- From: Tim Olsen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 17, 2001 2:12 AM To: [EMAIL PROTECTED] Subject: [PHP] passing variables from forms to the same page repetatively People, I have 4 forms in four seperate html pages included directly (no links to includes) in the same .php file, i have it so all the form actions is php.self, so when each form is submitted it goes on to display the next form in line, using if and else statements, of course. I want to be able to use variables created by the first form in the html part of the last form. What is the best way to do this? So far, I can only use variables on the next page (form) that is written out. After that those variables have no value. Is there some way to submit all variables present and assigned with the submission of each form? If I make the forms a seperate include file, instead of having them in-line, how does this change the ways variables are passed or submitted by each form? Thanks, - Tim _ Get your FREE download of MSN Explorer at http://explorer.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passing variables from forms to the same page repetatively
On Tue, 17 Jul 2001 15:41, Tim Olsen wrote: People, I have 4 forms in four seperate html pages included directly (no links to includes) in the same .php file, i have it so all the form actions is php.self, so when each form is submitted it goes on to display the next form in line, using if and else statements, of course. I want to be able to use variables created by the first form in the html part of the last form. What is the best way to do this? So far, I can only use variables on the next page (form) that is written out. After that those variables have no value. Is there some way to submit all variables present and assigned with the submission of each form? If I make the forms a seperate include file, instead of having them in-line, how does this change the ways variables are passed or submitted by each form? Thanks, - Tim _ If I understand what you are saying: those variables don't exist until you SUBMIT the form. You can demonstrate this by looping through and displaying your POST or GET vars at the beginning of the form and see what happens when you first open the page, and when it calls itself. And re-reading, I think what you may want is hidden fields. You want part one to call part 2, and retain values from part 1, etc? Echo the values into hidden fields in each step of the process. INPUT TYPE=hidden NAME=whatever VALUE=?php echo $whatever ? -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA I always lie. In fact, I'm lying to you right now! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passing variables from forms to the same page repetatively
Yeah, I had thought about using hidden inputs, but hidden inputs are not really hidden. They still exist on the HTML page, and although not visible in the browser, are visible in the code. This may not be cool if you have sensitive information that is passed, also if you have a lot of variables to pass, thats just a lot of hidden inputs to pass. Is there no other way to accomplish this? No built in function? I guess it makes sense that there is not, b/c the form submits the form and only the form variables. Thanks. -Tim Original Message Follows From: David Robley [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Tim Olsen [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP] passing variables from forms to the same page repetatively Date: Tue, 17 Jul 2001 16:13:41 +0930 On Tue, 17 Jul 2001 15:41, Tim Olsen wrote: People, I have 4 forms in four seperate html pages included directly (no links to includes) in the same .php file, i have it so all the form actions is php.self, so when each form is submitted it goes on to display the next form in line, using if and else statements, of course. I want to be able to use variables created by the first form in the html part of the last form. What is the best way to do this? So far, I can only use variables on the next page (form) that is written out. After that those variables have no value. Is there some way to submit all variables present and assigned with the submission of each form? If I make the forms a seperate include file, instead of having them in-line, how does this change the ways variables are passed or submitted by each form? Thanks, - Tim _ If I understand what you are saying: those variables don't exist until you SUBMIT the form. You can demonstrate this by looping through and displaying your POST or GET vars at the beginning of the form and see what happens when you first open the page, and when it calls itself. And re-reading, I think what you may want is hidden fields. You want part one to call part 2, and retain values from part 1, etc? Echo the values into hidden fields in each step of the process. INPUT TYPE=hidden NAME=whatever VALUE=?php echo $whatever ? -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA I always lie. In fact, I'm lying to you right now! _ Get your FREE download of MSN Explorer at http://explorer.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passing variables from forms to the same page repetatively
There are a thousand ways to pass data... some are just more kludgy than others =) In addition to using hidden fields You could put the data into a Database You could Write it to a file You could put it in a cookie You could use sessions etc, etc, ad nauseam Two things to point out, however. The first is that using Hidden fields is not really frowned down upon (at least not by anyone I know) and will probably lead to the least convoluted code. The second is that anything passed in a form (unless you are using SSL or something) is already insecure. If you have truly sensitive information you need to be looking into encryption, if not then why sweat the hidden fields? Sheridan - Original Message - From: Tim Olsen [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, July 17, 2001 1:07 PM Subject: Re: [PHP] passing variables from forms to the same page repetatively Yeah, I had thought about using hidden inputs, but hidden inputs are not really hidden. They still exist on the HTML page, and although not visible in the browser, are visible in the code. This may not be cool if you have sensitive information that is passed, also if you have a lot of variables to pass, thats just a lot of hidden inputs to pass. Is there no other way to accomplish this? No built in function? I guess it makes sense that there is not, b/c the form submits the form and only the form variables. Thanks. -Tim Original Message Follows From: David Robley [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Tim Olsen [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP] passing variables from forms to the same page repetatively Date: Tue, 17 Jul 2001 16:13:41 +0930 On Tue, 17 Jul 2001 15:41, Tim Olsen wrote: People, I have 4 forms in four seperate html pages included directly (no links to includes) in the same .php file, i have it so all the form actions is php.self, so when each form is submitted it goes on to display the next form in line, using if and else statements, of course. I want to be able to use variables created by the first form in the html part of the last form. What is the best way to do this? So far, I can only use variables on the next page (form) that is written out. After that those variables have no value. Is there some way to submit all variables present and assigned with the submission of each form? If I make the forms a seperate include file, instead of having them in-line, how does this change the ways variables are passed or submitted by each form? Thanks, - Tim _ If I understand what you are saying: those variables don't exist until you SUBMIT the form. You can demonstrate this by looping through and displaying your POST or GET vars at the beginning of the form and see what happens when you first open the page, and when it calls itself. And re-reading, I think what you may want is hidden fields. You want part one to call part 2, and retain values from part 1, etc? Echo the values into hidden fields in each step of the process. INPUT TYPE=hidden NAME=whatever VALUE=?php echo $whatever ? -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA I always lie. In fact, I'm lying to you right now! _ Get your FREE download of MSN Explorer at http://explorer.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passing variables from forms to the same page repetatively
What about registering some session variables? Sessions use cookies and/or URLs to propagate info across multiple pages. Not really secure, though, but they are easy to use. Mick On Wed, 18 Jul 2001, Tim Olsen wrote: Yeah, I had thought about using hidden inputs, but hidden inputs are not really hidden. They still exist on the HTML page, and although not visible in the browser, are visible in the code. This may not be cool if you have sensitive information that is passed, also if you have a lot of variables to pass, thats just a lot of hidden inputs to pass. Is there no other way to accomplish this? No built in function? I guess it makes sense that there is not, b/c the form submits the form and only the form variables. Thanks. -Tim Original Message Follows From: David Robley [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Tim Olsen [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP] passing variables from forms to the same page repetatively Date: Tue, 17 Jul 2001 16:13:41 +0930 On Tue, 17 Jul 2001 15:41, Tim Olsen wrote: People, I have 4 forms in four seperate html pages included directly (no links to includes) in the same .php file, i have it so all the form actions is php.self, so when each form is submitted it goes on to display the next form in line, using if and else statements, of course. I want to be able to use variables created by the first form in the html part of the last form. What is the best way to do this? So far, I can only use variables on the next page (form) that is written out. After that those variables have no value. Is there some way to submit all variables present and assigned with the submission of each form? If I make the forms a seperate include file, instead of having them in-line, how does this change the ways variables are passed or submitted by each form? Thanks, - Tim _ If I understand what you are saying: those variables don't exist until you SUBMIT the form. You can demonstrate this by looping through and displaying your POST or GET vars at the beginning of the form and see what happens when you first open the page, and when it calls itself. And re-reading, I think what you may want is hidden fields. You want part one to call part 2, and retain values from part 1, etc? Echo the values into hidden fields in each step of the process. INPUT TYPE=hidden NAME=whatever VALUE=?php echo $whatever ? -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA I always lie. In fact, I'm lying to you right now! _ Get your FREE download of MSN Explorer at http://explorer.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Michael Hall mulga.com.au [EMAIL PROTECTED] ph/fax (+61 8) 8953 1442 ABN 94 885 174 814 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passing variables from forms to the same page repetatively
On 17 Jul 01, at 0:11, Tim Olsen wrote: So far, I can only use variables on the next page (form) that is written out. After that those variables have no value. Is there some way to submit Investigate using input type=hidden form tages - very useful for passing around additional args between pages/forms. CYA, Dave --- Outback Queensland Internet - Longreach, Outback Queensland - Australia http://www.outbackqld.net.au mailto:[EMAIL PROTECTED] --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]