$discount = ; "; break; case "DB2006E": echo ""; break; case "DB2007W": echo ""; break; default: echo ""; break; }?> "> How to code discount coupon - Forums

Forums

How to code discount coupon

gmignard 08 Sep, 2008
Hi all,
I have a simple form that needs to read a coupon then send the discounted amount. I have each of the separate code junks working but can't seem to get them to work together. Any help/suggestions is greatly appreciated.
Gail

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
 
Coupon:  <input type="text" size="20" name="coupon"><br>
  //  <input type="hidden" name="amount" value=""><br>
    <hr>
    <P>
   

 <?php
    // Check if the form is editable or not 
    $readonly = "";
    $edit = true;
    if ( $_POST['submit'] && $_POST['submit'] == "Confirm" ) {
      $edit = false;
      $readonly = "readonly='readonly'";
      print ($edit);
    }
    ?>


<?php

//check results
if (!$edit && $_POST['coupon']){ 
?>	

      Coupon: <?php echo ''.$_POST["coupon"].'  <br /> ';

     echo ' <input value="'.$_POST["coupon"].'" name="coupon" type="hidden" /> <br /> ';
 
     echo ' <hr><br> ';	
     $discount = '.$_POST["coupon"].';
     echo '$discount = '.$_POST["coupon"].' '; 
 ?>         
  
$discount = <?php echo ' "'.$_POST["coupon"].'"'?>;
   
<?php
   
   switch($discount)  {
     case "DB2007E":
       echo "<input type=\"hidden\" name=\"amount\" value=\"77.85\"><br>";
       break; 
     case "DB2006E":
       echo "<input type=\"hidden\" name=\"amount\" value=\"77.85\"><br>";
       break; 
     case "DB2007W":
       echo "<input type=\"hidden\" name=\"amount\" value=\"77.85\"><br>";
       break; 
     default:
       echo "<input type=\"hidden\" name=\"amount\" value=\"86.50\"><br>";
       break; 
     }
?>
<?php
} 
else {
// FORM
}
?>

   
     <?php
    
    if ( $edit ) {
    ?>
    <div>
    <input type="submit" name="submit" value="Submit" >    
    <input type="reset" value="Reset Form"> </div> 
<?php 
} else { 
?>
<div><input type="submit" name="submit" value="Confirm" >
  <input type="submit" name="submit" value="Edit" > 
    </div> 
    <?php
    }
    ?>
</form>
Max_admin 09 Sep, 2008
hi, form tags <form> </form> cant be used in Chronoforms HTML box!

regards

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.