npn2531 Posted January 11, 2011 Share Posted January 11, 2011 I would like to pass a variable from checkout_confirmation.php through checkout_process.php to either back to checkout_confirmation or on to checkout_success.php. I can get the variable to checkout_process.php with something like this echo tep_draw_form('myform', 'checkout_process.php', 'post'); echo tep_draw_hidden_field('myform', 'value'); echo tep_image_submit('', '','value="submit"') and pick it up on checkout_process.php with this: if (tep_not_null($HTTP_POST_VARS['myform'])) { $value = tep_db_prepare_input($HTTP_POST_VARS['value']); } But I would like to be able to echo $value on checkout_confirmation.php or checkout_success.php after checkout_process.php. Is this a simple way to do this? Thanks! Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
germ Posted January 11, 2011 Share Posted January 11, 2011 The alernative wold be to register it as a session variable. Then it doesn't have to be "posted" from page to page. There are pro's and con's to both methods. I just thought I'd mention it. :) If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
npn2531 Posted January 11, 2011 Author Share Posted January 11, 2011 Thanks, I'll give it a go, it looks like your link here is a good primer on this? http://www.oscommerce.com/forums/index.php?showtopic=299001&hl=variable And what would be a few of the pros and cons? Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
germ Posted January 12, 2011 Share Posted January 12, 2011 On the page where it get's it's initialized value try code like this: <?php $myvar = SOME_VALUE; // give it a value here if ( ! tep_session_is_registered('myvar') ) { tep_session_register('myvar'); } ?> Be certain you use a unique name for the variable that osC doesn't use. Then on all the other pages you just reference it as $myvar Well, if you pass things page to page in the URL string people can manually alter them so you have to watch for that. Then I suppose the con would be it adds a little more overhead, but a few more variables won't hurt. The code example above has worked for me every time I've used it in osC. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
npn2531 Posted January 12, 2011 Author Share Posted January 12, 2011 Thanks, your code above worked very well. And yes, this is much easier than 'posting' and I do like that it does not show up in the url. I assume using 'tep_session_register' like this is independent of (will not interefere with) the 'tep_session_is_registered' function which is plastered up and down checkout_process.php and rest of the checkout pages?? Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
germ Posted January 12, 2011 Share Posted January 12, 2011 As long as you don't use a variable that osC uses - no problem! :) If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
npn2531 Posted January 12, 2011 Author Share Posted January 12, 2011 Got it. Thanks again. :D Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
npn2531 Posted January 12, 2011 Author Share Posted January 12, 2011 ? Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.