> I am trying to customize a shopping cart. I need to inject a page in > the checkout process that must be checked (terms and conditions), before > continuing. > > I have it working halfway. In checkout_payment.php I have an if stmt > > ************************************************************************* > > //if terms and conditions hasnt been checked redirect to conditions.php > if ($HTTP_POST_VARS['agree'] != 'true') { > tep_redirect(tep_href_link(FILENAME_CONDITIONS, '', 'SSL')); > } > > ************************************************************************* > > So - if you go to checkout_payment and that box hasnt been checked it'll > send you to conditions.php. If you go to conidtions.php and dont check > the box - the page keeps reloading, which is ok for now. > > In conditions.php I have > > ************************************************************************* > > <form name="conditions" action = checkout_payment.php method="post"> > <tr><td><?php echo tep_draw_checkbox_field('agree','true');?>Check > this box to accept Terms and Conditions</td> > <td align="right" class="main"><br> > <input type= "submit" value = "continue"></td></tr> > </form> > > ************************************************************************* > > If the box is checked it goes to checkout_payment.php Ok, but when you > click continue from checkout_payment it goes back to conditions.php like > the variable has been reset to false. (I think) Essentially because the > script is running again I guess. > > Should I try to set this var in the session ? Or do a simple javascript > validation in conditions.php ??? Yeah, that'd probably be your best option. You need to "remember" that the user already clicked "agree" for the rest of your checkout process. Sessions are ideal for that. A regular cookie could work, also, but remember it can be spoofed. So on the checkout_payment page you'd check if a $_SESSION['agree'] is set or not. If it's not, then redirect to conditions.php and have them agree. checkout_payment.php would also have to handle the processing of the form from conditions.php and set the $_SESSION['agreee'] variable when they click agree. If $_SESSION['agree'] is set (using isset(), mind you), then you proceed with your checkout. Hope that helps. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php