Jump to content

learningcurve

Members
  • Posts

    44
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

learningcurve's Achievements

Member

Member (2/5)

0

Reputation

  1. I know this can be done, but I just can't write the javascript correctly to make it work. I have these two form elements: <input type="radio" name="JECT" value="no" checked <?php if(@$JECT=="no"){ echo "checked";}?>> No thanks</br> <input type='radio' name='JECT' value='JECTindividual_print' <?php if(@$JECT=="JECTindividual_print"){ echo "checked";}?>> Print subscription (US and Canada only): US $<?php echo $JECTindividual_print_price['base']['United States']; ?>, Canada $<?php echo $JECTindividual_print_price['base']['Canada']; ?></br> <input type='radio' name='JECT' value='JECTindividual_electronic' <?php if(@$JECT=="JECTindividual_electronic"){ echo "checked";}?>> Electronic subscription (access to complete online archive): $<?php echo $JECTindividual_electronic_price['base']; ?></br> <input type='radio' name='JECT' value='JECTindividual_combo' <?php if(@$JECT=="JECTindividual_combo"){ echo "checked";}?>> Combination print and electronic subscription (US and Canada only): $<?php echo $JECTindividual_combo_price['base']; ?></br> <p style="text-indent:30px;">Length of subscription:</br></p> <label><input type="radio" name="JECTsub" value="1" checked <?php if(@$JECTsub=="1"){ echo "checked";}?>> 1 year</label></br> <label><input type="radio" name="JECTsub" value="2" <?php if(@$JECTsub=="2"){ echo "checked";}?>> 2 years</label></br> <label><input type="radio" name="JECTsub" value="3" <?php if(@$JECTsub=="3"){ echo "checked";}?>> 3 years</label></br> <label><input type='checkbox' name='JECTrenewal' value='yes' <?php if(@$JECTrenewal=="yes"){ echo "checked";}?>> Check box if this is a renewal</label></br> If the "no" radio button is checked (in other words, if $JECT="no", I want the JECTsub radio buttons to not show. if any other value is chosen for JECT, I want the JECTsub buttons to show. Thanks ahead for the help.
  2. <td>size 2 <br /><input type="radio" value="2" name="size" /></td> <td>Size 4 <br /><input type="radio" value="4" name="size" /></td> <td>Size 8 <br /><input type="radio" value="8" name="size" /></td> You already have three radio buttons with the sizes - just add the price to the radio text (which you might want to clean up a little). Unless you need to have different prices for bus/res and if you actually need to do something with those prices - like calculations, etc. So...do you need PHP or is this an HTML coding issue?
  3. Thanks Psycho, for the helpful tips. And of course, big thanks to mac_gyver. I consider you a genius and wish you were my personal Yoda. It would make learning php a lot easier. You were on spot. Once this is working, I am going to go back and see if I can weed it - there is way too much. Slowly learning how to crawl...
  4. I have an order site. I wrote some of the code, but not all. When someone orders from this page: <?php include 'header.php'; if(isset($_POST['redo'])){ extract($_POST); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Journal Individual Order Form</title> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <link href="http://celt.edu/ject/images/favicon.png" rel="shortcut icon"> <style type="text/css"> </style> <script type="text/javascript"> function remove_space(ids,vals){ document.getElementById(ids).value=vals.replace(/(^\s*)/g, ""); var new_txt=document.getElementById(ids).value; document.getElementById(ids).value=new_txt.replace(/'/g, ""); } function form_validate(){ var name=document.getElementById('firstname').value; var lname=document.getElementById('lastname').value; var email=document.getElementById('email').value; var phone=document.getElementById('phone').value; var address=document.getElementById('address').value; var city=document.getElementById('city').value; var zip=document.getElementById('zip').value; var regemail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,6})$/; var mess=""; if(name==""){ mess= mess+"Please Enter Your First Name \n"; } if(lname==""){ mess= mess+"Please Enter Your Last Name \n"; } if(phone==""){ mess= mess+"Phone cannot be Blank \n"; } if(email==""){ mess= mess+"Email cannot be Blank \n"; } if(email!=""){ if(! regemail.test(email)){ mess= mess+"Invalid Email Format \n"; } } if(address==""){ mess= mess+"Please Enter Your Street \n"; } if(city==""){ mess= mess+"Please Enter Your City \n"; } if(zip==""){ mess= mess+"Please Enter Your Zip \n"; } if(document.subscriptionForm.payment_method[0].checked==false && (document.subscriptionForm.payment_method[1].checked==false && document.subscriptionForm.payment_method[2].checked==false)){ mess= mess+"Please Select The Payment Type \n"; } if(mess){ alert(mess); return false; } return true; } </script> </head> <body onLoad="recalc()"> <h1 style="margin-top: 0;">Individual subscription order form</h1> <h2><b><FONT COLOR="#C41230">Discounts are offered to subscribers who purchase subscriptions for two or more CELTUA journals.</FONT></b></h2> <h3>Choose two journals for <?php echo DISCOUNT_2Journals_per; ?>% off your total order or subscribe to all three for <?php echo DISCOUNT_3Journals_per; ?>% off your total order. </h3> <p>Individual subscriptions can be done three ways: </p> <ul> <li> an individual print subscription, shipped to the address you provide <ul> <li>4 issues per year for <em>Journal on Excellence</em>, new subscriptions will start with Volume <?php echo $JECTsubscribeVolume['vol']; ?>, <?php echo $JECTsubscribeVolume['year']; ?></li> <li>1 issue per year for <em>Journal on Centers</em>, new subscriptions will start with Volume <?php echo $JCTLsubscribeVolume['vol']; ?>, <?php echo $JCTLsubscribeVolume['year']; ?></li> <li>1 issue per year for <em>Learning Communities</em>, new subscriptions will start with Volume <?php echo $LCJsubscribeVolume['vol']; ?>, <?php echo $LCJsubscribeVolume['year']; ?></li> </ul> </li> <li>an individual electronic subscription (access to complete online archive) -- electronic subscribers can browse articles by issue and search article abstracts</li> <li>a combination print and electronic subscription at a special discount rate</li> </ul> <p>Select the subscription option that suits your needs using the form below. Print subscriptions can only be shipped to the US and Canada.</p> <form action='order_review.php' method='post' id='subscriptionForm' name="subscriptionForm" onsubmit="return form_validate()"> <input type="hidden" name="subscription_type" value="individual"/> <input type="hidden" name="id_subcount" value="" id="id_subcount"/> <input type="hidden" name="jectprice_hidden" id="jectprice_hidden" value=""/> <input type="hidden" name="jctlprice_hidden" id="jctlprice_hidden" value=""/> <input type="hidden" name="lcjprice_hidden" id="lcjprice_hidden" value=""/> <h2>Recipient's contact information</h2> <table> <tr> <th>First name:</th> <td><input type='text' name='firstname' id="firstname" onblur="remove_space(this.id,this.value)" value="<?php if(isset($firstname)) { echo $firstname;} ?>" /></td> </tr> <tr> <th>Last name:</th> <td><input type='text' name='lastname' value="<?php if(isset($lastname)) { echo $lastname;} ?>" onblur="remove_space(this.id,this.value)" id="lastname"/></td> </tr> <tr> <th>Department (if applicable):</th> <td><input type='text' name='department' value="<?php if(isset($department)) { echo $department;} ?>" onblur="remove_space(this.id,this.value)" id="department"/></td> </tr> <tr> <th>Institution (if applicable):</th> <td><input type='text' name='institution' value="<?php if(isset($institution)) { echo $institution;} ?>" onblur="remove_space(this.id,this.value)" id="institution"/></td> </tr> <tr> <th>Phone number:</th> <td><input type='text' name='phone' value="<?php if(isset($phone)) { echo $phone;} ?>" onblur="remove_space(this.id,this.value)" id="phone"/></td> </tr> <tr> <th>Email address:</th> <td><input type='text' name='email' value="<?php if(isset($email)) { echo $email;} ?>" onblur="remove_space(this.id,this.value)" id="email"/></td> </tr> <tr> <th>Street address:</th> <td><textarea name='address' cols='40' rows='5' onblur="remove_space(this.id,this.value)" id="address"/><?php if(isset($address)) { echo $address;} ?></textarea></td> </tr> <tr> <th>City:</th> <td><input type='text' name='city' value="<?php if(isset($city)) { echo $city;} ?>" onblur="remove_space(this.id,this.value)" id="city"/></td> </tr> <tr> <th>State/Province:</th> <td><input type='text' name='state' value="<?php if(isset($state)) { echo $state;} ?>" onblur="remove_space(this.id,this.value)" id="state"/></td> </tr> <tr> <th>ZIP/Postal code:</th> <td><input type='text' name='zip' value="<?php if(isset($zip)) { echo $zip;} ?>" onblur="remove_space(this.id,this.value)" id="zip"/></td> </tr> <tr> <th>Country:</th> <td> <select name='usCan' id="usCan"> <option value='United States' >United States</option> <option value='Canada' >Canada</option> <option value='Other' >Other:</option> </select> <input type='text' name='country' id='country' value="<?php if(isset($usCan)) { echo $usCan;} ?>" > </td> </tr> </table> <h2>Subscription Options</h2> <h3>Please choose the options you desire.</h3> <FONT SIZE="+1"> <h3><b><em>Journal on Excellence</em></b></h3> </FONT> <input type="radio" name="JECT" value="no" checked <?php if(@$JECT=="no"){ echo "checked";}?>> No thanks</br> <input type='radio' name='JECT' value='JECTindividual_print' <?php if(@$JECT=="JECTindividual_print"){ echo "checked";}?>> Print subscription (US and Canada only): US $<?php echo $JECTindividual_print_price['base']['United States']; ?>, Canada $<?php echo $JECTindividual_print_price['base']['Canada']; ?></br> <input type='radio' name='JECT' value='JECTindividual_electronic' <?php if(@$JECT=="JECTindividual_electronic"){ echo "checked";}?>> Electronic subscription (access to complete online archive): $<?php echo $JECTindividual_electronic_price['base']; ?></br> <input type='radio' name='JECT' value='JECTindividual_combo' <?php if(@$JECT=="JECTindividual_combo"){ echo "checked";}?>> Combination print and electronic subscription (US and Canada only): $<?php echo $JECTindividual_combo_price['base']; ?></br> <p style="text-indent:30px;">Length of subscription:</br></p> <label><input type="radio" name="JECTsub" value="1" checked <?php if(@$JECTsub=="1"){ echo "checked";}?>> 1 year</label></br> <label><input type="radio" name="JECTsub" value="2" <?php if(@$JECTsub=="2"){ echo "checked";}?>> 2 years</label></br> <label><input type="radio" name="JECTsub" value="3" <?php if(@$JECTsub=="3"){ echo "checked";}?>> 3 years</label></br> <label><input type='checkbox' name='JECTrenewal' value='yes' <?php if(@$JECTrenewal=="yes"){ echo "checked";}?>> Check box if this is a renewal</label></br> <FONT SIZE="+1"> <h3><b><em>Journal on Centers</em></b></h3> </FONT> <input type="radio" name="JCTL" value="no" checked <?php if(@$JCTL=="no"){ echo "checked";}?>> No thanks</br> <input type='radio' name='JCTL' value='JCTLindividual_print' <?php if(@$JCTL=="JCTLindividual_print"){ echo "checked";}?>> Print subscription (US and Canada only): US $<?php echo $JCTLindividual_print_price['base']['United States']; ?>, Canada $<?php echo $JCTLindividual_print_price['base']['Canada']; ?></br> <input type='radio' name='JCTL' value='JCTLindividual_electronic' <?php if(@$JCTL=="JCTLindividual_electronic"){ echo "checked";}?>> Electronic subscription (access to complete online archive): $<?php echo $JCTLindividual_electronic_price['base']; ?></br> <input type='radio' name='JCTL' value='JCTLindividual_combo' <?php if(@$JCTL=="JCTLindividual_combo"){ echo "checked";}?>> Combination print and electronic subscription (US and Canada only): $<?php echo $JCTLindividual_combo_price['base']; ?></br> <p style="text-indent:30px;">Length of subscription:</br></p> <label><input type="radio" name="JCTLsub" value="1" checked <?php if(@$JCTLsub=="1"){ echo "checked";}?>> 1 year</label></br> <label><input type="radio" name="JCTLsub" value="2" <?php if(@$JCTLsub=="2"){ echo "checked";}?>> 2 years</label></br> <label><input type="radio" name="JCTLsub" value="3" <?php if(@$JCTLsub=="3"){ echo "checked";}?>> 3 years</label></br> <label><input type='checkbox' name='JCTLrenewal' value='yes' <?php if(@$JCTLrenewal=="yes"){ echo "checked";}?>> Check box if this is a renewal</label></br> <FONT SIZE="+1"> <h3><b><em>Learning Communities</em></b></h3> </FONT> <input type="radio" name="LCJ" value="no" checked <?php if(@$LCJ=="no"){ echo "checked";}?>> No thanks</br> <input type='radio' name='LCJ' value='LCJindividual_print' <?php if(@$LCJ=="LCJindividual_print"){ echo "checked";}?>> Print subscription (US and Canada only): US $<?php echo $LCJindividual_print_price['base']['United States']; ?>, Canada $<?php echo $LCJindividual_print_price['base']['Canada']; ?></br> <input type='radio' name='LCJ' value='LCJindividual_electronic' <?php if(@$LCJ=="LCJindividual_electronic"){ echo "checked";}?>> Electronic subscription (access to complete online archive): $<?php echo $LCJindividual_electronic_price['base']; ?></br> <input type='radio' name='LCJ' value='LCJindividual_combo' <?php if(@$LCJ=="LCJindividual_combo"){ echo "checked";}?>> Combination print and electronic subscription (US and Canada only): $<?php echo $LCJindividual_combo_price['base']; ?></br> <p style="text-indent:30px;">Length of subscription:</br></p> <label><input type="radio" name="LCJsub" value="1" checked <?php if(@$LCJsub=="1"){ echo "checked";}?>> 1 year</label></br> <label><input type="radio" name="LCJsub" value="2" <?php if(@$LCJsub=="2"){ echo "checked";}?>> 2 years</label></br> <label><input type="radio" name="LCJsub" value="3" <?php if(@$LCJsub=="3"){ echo "checked";}?>> 3 years</label></br> <label><input type='checkbox' name='LCJrenewal' value='yes' <?php if(@$LCJrenewal=="yes"){ echo "checked";}?>> Check box if this is a renewal</label></br> <h2>Payment</h2> <h3 id="grandTotal">Total: $0.00</h3> <input type="hidden" name="total"> <input type="hidden" name="subtotal"> <input type="hidden" name="discount"> <input type="hidden" name="itemprice1"> <input type="hidden" name="itemprice2"> <input type="hidden" name="itemprice3"> <p>Please indicate how you wish to pay:</p> <table class="payment"> <tr> <td> <input type='radio' name='payment_method' value='Credit card (online)' <?php if(@$payment_method=="Credit card (online)"){ echo "checked";}?>> <b>Credit card (online)</b> </td> <td> You will be taken to our secure payment site once you verified your order. Please have your credit card ready. <strong>(MasterCard, Visa, Discover, or American Express)</strong> </td> </tr> <tr> <td> <input type='radio' name='payment_method' value='Credit card (phone)' <?php if(@$payment_method=="Credit card (phone)"){ echo "checked";}?>> <b>Credit card (phone)</b> </td> <td> Please contact Matthew to make your payment. <strong>(MasterCard or Visa only)</strong> </td> </tr> <tr> <td> <input type='radio' name='payment_method' value='Check' <?php if(@$payment_method=="no"){ echo "Check";}?>> <b>Check or Money order</b></td> <td>Please make check or money order to:</br> Subscription Manager</td> </tr> </table> <p>Once you have completed this form and agree to the above terms, click the "Continue" button below to review your order and view your invoice. Your order will not be placed until you approve the invoice in the next step.</p> <p><input type="submit" name="submit" value="Continue"></p> </form> </div> <!-- end of mainbody --> <script type="text/javascript"> var prices = { "United States" : { "JECT" : [ 0, <?php echo $JECTindividual_print_price['base']['United States'] ?>, <?php echo $JECTindividual_electronic_price['base'] ?>, <?php echo $JECTindividual_combo_price['base'] ?> ], "JCTL" : [ 0, <?php echo $JCTLindividual_print_price['base']['United States'] ?>, <?php echo $JCTLindividual_electronic_price['base'] ?>, <?php echo $JCTLindividual_combo_price['base'] ?> ], "LCJ" : [ 0, <?php echo $LCJindividual_print_price['base']['United States'] ?>, <?php echo $LCJindividual_electronic_price['base'] ?>, <?php echo $LCJindividual_combo_price['base'] ?> ], "JECT_10" : [ 0, <?php echo $JECTindividual_print_price['10']['United States'] ?>, <?php echo $JECTindividual_electronic_price['10'] ?>, <?php echo $JECTindividual_combo_price['10'] ?> ], "JCTL_10" : [ 0, <?php echo $JCTLindividual_print_price['10']['United States'] ?>, <?php echo $JCTLindividual_electronic_price['10'] ?>, <?php echo $JCTLindividual_combo_price['10'] ?> ], "LCJ_10" : [ 0, <?php echo $LCJindividual_print_price['10']['United States'] ?>, <?php echo $LCJindividual_electronic_price['10'] ?>, <?php echo $LCJindividual_combo_price['10'] ?> ], "JECT_15" : [ 0, <?php echo $JECTindividual_print_price['15']['United States'] ?>, <?php echo $JECTindividual_electronic_price['15'] ?>, <?php echo $JECTindividual_combo_price['15'] ?> ], "JCTL_15" : [ 0, <?php echo $JCTLindividual_print_price['15']['United States'] ?>, <?php echo $JCTLindividual_electronic_price['15'] ?>, <?php echo $JCTLindividual_combo_price['15'] ?> ], "LCJ_15" : [ 0, <?php echo $LCJindividual_print_price['15']['United States'] ?>, <?php echo $LCJindividual_electronic_price['15'] ?>, <?php echo $LCJindividual_combo_price['15'] ?> ] }, "Canada" : { "JECT" : [ 0, <?php echo $JECTindividual_print_price['base']['Canada'] ?>, <?php echo $JECTindividual_electronic_price['base'] ?>, <?php echo $JECTindividual_combo_price['base'] ?> ], "JCTL" : [ 0,<?php echo $JCTLindividual_print_price['base']['Canada'] ?>, <?php echo $JCTLindividual_electronic_price['base'] ?>, <?php echo $JCTLindividual_combo_price['base'] ?> ], "LCJ" : [ 0, <?php echo $LCJindividual_print_price['base']['Canada'] ?>, <?php echo $LCJindividual_electronic_price['base'] ?>, <?php echo $LCJindividual_combo_price['base'] ?> ], "JECT_10" : [ 0, <?php echo $JECTindividual_print_price['10']['Canada'] ?>, <?php echo $JECTindividual_electronic_price['10'] ?>, <?php echo $JECTindividual_combo_price['10'] ?> ], "JCTL_10" : [ 0,<?php echo $JCTLindividual_print_price['10']['Canada'] ?>, <?php echo $JCTLindividual_electronic_price['10'] ?>, <?php echo $JCTLindividual_combo_price['10'] ?> ], "LCJ_10" : [ 0, <?php echo $LCJindividual_print_price['10']['Canada'] ?>, <?php echo $LCJindividual_electronic_price['10'] ?>, <?php echo $LCJindividual_combo_price['10'] ?> ], "JECT_15" : [ 0, <?php echo $JECTindividual_print_price['15']['Canada'] ?>, <?php echo $JECTindividual_electronic_price['15'] ?>, <?php echo $JECTindividual_combo_price['15'] ?> ], "JCTL_15" : [ 0,<?php echo $JCTLindividual_print_price['15']['Canada'] ?>, <?php echo $JCTLindividual_electronic_price['15'] ?>, <?php echo $JCTLindividual_combo_price['15'] ?> ], "LCJ_15" : [ 0, <?php echo $LCJindividual_print_price['15']['Canada'] ?>, <?php echo $LCJindividual_electronic_price['15'] ?>, <?php echo $LCJindividual_combo_price['15'] ?> ] }, "Other" : { "JECT" : [ 0, -1, <?php echo $JECTindividual_electronic_price['base'] ?>, -1 ], "JCTL" : [ 0, -1, <?php echo $JCTLindividual_electronic_price['base'] ?>, -1 ], "LCJ" : [ 0, -1, <?php echo $LCJindividual_electronic_price['base'] ?>, -1 ] } }; var form = document.getElementById("subscriptionForm"); // set up the calls to recalc from all checkboxes and radio buttons var inps = form.getElementsByTagName("input"); for ( var i = 0; i < inps.length; ++i ) { var inp = inps[i]; if ( inp.type == "checkbox" || inp.type == "radio" ) { inp.onclick = recalc; } } // and also from a change of country: form.usCan.onchange = recalc; function groupValue( group ) { for ( var g = 0; g < group.length; ++g ) { if ( group[g].checked ) return g; } return 0; } function recalc( ) { var msg = document.getElementById("grandTotal"); var country = form.usCan.value; var priceTable = prices[country]; var ject = groupValue( form.JECT ); var jctl = groupValue( form.JCTL ); var lcj = groupValue( form.LCJ ); var jectprice_hidden=0; var jctlprice_hidden=0; var lcjprice_hidden=0; var subcount = ( ject > 0 ? 1 : 0 ) + ( jctl > 0 ? 1 : 0 ) + ( lcj > 0 ? 1 : 0 ); var jectprice = priceTable["JECT"][ ject ]; var jctlprice = priceTable["JCTL"][ jctl ]; var lcjprice = priceTable["LCJ" ][ lcj ]; if(subcount==1){ var jectprice_hidden = priceTable["JECT"][ ject ]; var jctlprice_hidden = priceTable["JCTL"][ jctl ]; var lcjprice_hidden = priceTable["LCJ" ][ lcj ]; } if(subcount==2){ var jectprice_hidden = priceTable["JECT_10"][ ject ]; var jctlprice_hidden = priceTable["JCTL_10"][ jctl ]; var lcjprice_hidden = priceTable["LCJ_10" ][ lcj ]; } if(subcount==3){ var jectprice_hidden = priceTable["JECT_15"][ ject ]; var jctlprice_hidden = priceTable["JCTL_15"][ jctl ]; var lcjprice_hidden = priceTable["LCJ_15" ][ lcj ]; } if ( jectprice < 0 || jctlprice < 0 || lcjprice < 0 ) { msg.innerHTML = '<span style="color: red;">' + "You can not order print or combo editions from outside the US and Canada" + '</span>'; return -1; } var y_ject = groupValue( form.JECTsub ) + 1; var y_jctl = groupValue( form.JCTLsub ) + 1; var y_lcj = groupValue( form.LCJsub ) + 1; var total = jectprice * y_ject + jctlprice * y_jctl + lcjprice * y_lcj; var total_hidden = jectprice_hidden * y_ject + jctlprice_hidden * y_jctl + lcjprice_hidden * y_lcj; // alert(total_hidden); if(total_hidden){ document.getElementById('jectprice_hidden').value=jectprice_hidden; document.getElementById('jctlprice_hidden').value=jctlprice_hidden; document.getElementById('lcjprice_hidden').value=lcjprice_hidden; } var discount=0; var discount_price=0; if ( subcount == 2 ) { discount_price = <?php echo DISCOUNT_2Journals; ?> * total; // 10% discount discount=<?php echo DISCOUNT_2Journals_per; ?> } else if ( subcount == 3 ) { discount_price = <?php echo DISCOUNT_3Journals; ?> * total; // 15% discount discount=<?php echo DISCOUNT_3Journals_per; ?> } var msgtext = "Total: $" + total.toFixed(2); if ( discount_price >= 0 ) { msgtext += "<br/>Discount: -" + discount+"%"; var subtotal=total; total -= discount_price; if(total_hidden){ msgtext += "<br/>Grand total: $" + total_hidden.toFixed(2); } else{ msgtext += "<br/>Grand total: $" + total.toFixed(2); } } msg.innerHTML = msgtext; form.total.value = total.toFixed(2); form.subtotal.value = subtotal.toFixed(2); form.discount.value = discount; form.itemprice1.value = jectprice.toFixed(2); form.itemprice2.value = jctlprice.toFixed(2); form.itemprice3.value = lcjprice.toFixed(2); document.getElementById('id_subcount').value=subcount; return total; } </script> <?php include 'footer.php'; ?> </body> </html> It calculates the total correctly. When the information is passed to orderreview and then on to be processed, the total can be different. Here is the orderreview code: <?php include 'header.php'; include 'functions.php'; //print_r($_REQUEST);exit; extract($_REQUEST); $back_url=basename($_SERVER['HTTP_REFERER']); echo '<h2 style="margin-top: 0;">Review your order:</h2>'; echo '<p><b>Order for:</b></p>'; echo $_POST['firstname'].' '.$_POST['lastname'].'<br>'; if ($_POST['department']!='') echo $_POST['department'].'<br>'; if ($_POST['institution']!='') echo $_POST['institution'].'<br>'; //echo str_replace($returns,'<br>',$_POST['address']).'<br>'; echo $_POST['city'].', '.$_POST['state'].' '.$_POST['zip'].'<br>'; echo $country.'<br>'; echo $_POST['phone'].'<br>'; echo $_POST['email'].'</address>'; if($id_subcount==2){ $discount_rate=DISCOUNT_2Journals; } elseif($id_subcount==3){ $discount_rate=DISCOUNT_3Journals; }else{ $discount_rate=""; } ?> <table border="1"> <tr><th>Item</th><th>Base Price</br>(Single Year)</th><th>Your Price</br>(Single Year)</th><th>Length</th><th>Renewal?</th> <?php if ($subscription_type == "institutional") { ?> <th>Tier</th> <?php } ?> </tr> <?php $originalprice1 = $itemprice1 ?> <?php $originalprice2 = $itemprice2 ?> <?php $originalprice3 = $itemprice3 ?> <?php if($JECT && $JECT!="no"){ if($jectprice_hidden){ $itemprice1=$jectprice_hidden; } else { $itemprice1=$itemprice1; } ?> <tr> <td> <?php $JECTtext = $JECT; switch ($JECTtext) { case "JECTindividual_print": echo "Journal on Excellence (JECT) Individual Print Subscription"; break; case "JECTindividual_electronic": echo "Journal on Excellence (JECT) Individual Electronic Subscription"; break; case "JECTinstitutional_electronic": echo "Journal on Excellence(JECT) Insitutional Subscription"; break; case "JECTindividual_combo": echo "Journal on Excellence (JECT) Individual Combo Subscription"; break; case "JECTinstitutional_print": echo "Journal on Excellence (JECT) Institutional Print Subscription"; break; default: echo "Journal on Excellence (JECT) subscription"; } ?> </td> <td><?php echo $originalprice1; ?></td> <td><?php echo round($itemprice1,2); ?></td> <td><?php echo $JECTsub; ?></td> <td><?php if($JECTrenewal){ echo "Yes";} else { echo "No";} ?></td> <?php if ($subscription_type == "institutional") { ?> <td><?php echo $tier; ?></td> <?php } ?> </tr> <?php } ?> <?php if($JCTL && $JCTL!="no"){ if($jctlprice_hidden){ $itemprice2=$jctlprice_hidden; } else { $itemprice2=$itemprice2; } ?> <tr> <td> <?php $JCTLtext = $JCTL; switch ($JCTLtext) { case "JCTLindividual_print": echo "Journal on Centers(JCTL) Individual Print Subscription"; break; case "JCTLindividual_electronic": echo "Journal on Centers (JCTL) Individual Electronic Subscription"; break; case "JCTLinstitutional_electronic": echo "Journal on Centers (JCTL) Insitutional Subscription"; break; case "JCTLindividual_combo": echo "Journal on Centers (JCTL) Individual Combo Subscription"; break; case "JCTLinstitutional_print": echo "Journal on Centers (JCTL) Institutional Print Subscription"; break; default: echo "Journal on Centers (JCTL) subscription"; } ?> </td> <td><?php echo $originalprice2; ?></td> <td><?php echo round($itemprice2,2); ?></td> <td><?php echo $JCTLsub; ?></td> <td><?php if($JCTLrenewal){ echo "Yes";} else { echo "No";} ?></td> <?php if ($subscription_type == "institutional") { ?> <td><?php echo $tier; ?></td> <?php } ?> </tr> <?php } ?> <?php if($LCJ && $LCJ!="no"){ if($lcjprice_hidden){ $itemprice3=$lcjprice_hidden; } else { $itemprice3=$itemprice3; } ?> <tr> <td> <?php $LCJtext = $LCJ; switch ($LCJtext) { case "LCJindividual_print": echo "Learning Communities (LCJ) Individual Print Subscription"; break; case "LCJindividual_electronic": echo "Learning Communities (LCJ) Individual Electronic Subscription"; break; case "LCJinstitutional_electronic": echo "Learning Communities (LCJ) Insitutional Subscription"; break; case "LCJindividual_combo": echo "Learning Communities (LCJ) Individual Combo Subscription"; break; case "LCJinstitutional_print": echo "Learning Communities (LCJ) Institutional Print Subscription"; break; default: echo "Learning Communities (LCJ) subscription"; } ?> </td> <td><?php echo $originalprice3; ?></td> <td><?php echo round($itemprice3,2); ?></td> <td><?php echo $LCJsub; ?></td> <td><?php if($LCJrenewal){ echo "Yes";} else { echo "No";} ?></td> <?php if ($subscription_type == "institutional") { ?> <td><?php echo $tier; ?></td> <?php } ?> </tr> <?php } ?> </table> <?php if ($subscription_type == "institutional") { //$back_url="institutionalorder.php"; echo '<p>Institution details:</p><ul>'; if ($_POST['tech_contact']!='') echo "<li>Technical contact: ".$_POST['tech_contact'].'</li>'; if ($_POST['tc_phone']!='') echo "<li>Technical contact's phone: ".$_POST['tc_phone'].'</li>'; if ($_POST['tc_email']!='') echo "<li>Technical contact's email: ".$_POST['tc_email'].'</li>'; echo "<li>Network address(es):<ul><li>".str_replace($returns,'</li><li>',$_POST['net_addresses']).'</li></ul></li>'; echo '</ul>'; } else { //$back_url="individualorder.php"; } echo "<h3>Subtotal: ".$_POST['subtotal'].'</br>'; echo "Discount: ".$_POST['discount']."%".'</br>'; echo "Grand total: ".$_POST['total'].'</h3>'; echo '<p>Payment method: '.$_POST['payment_method'].'</p>'; echo '<h2>Review and submit</h2>'; echo '<p>Please review your order above to make sure it is correct, then print this page as your invoice/receipt. Finally, press the "Submit order" button below. You should receive a confirmation of your order via the email address you provided. We will begin processing it once we have received your payment. Please allow a maximum 7-10 days for you payment to be processed and for your order to be carried out.</p>'; //if ($_POST['payment_method']=='Credit card (online)') echo '<p>After you have clicked the "Submit order" button below, you will be taken to our secure payment site to complete the order. Please have your credit card ready.</p>'; echo '<table><tr>'; echo '<td> <form action="'.$back_url.'" method="post"> <input type="submit" name="redo" value="Go back and make changes">'; echo capturepostdata($_POST); echo '</form></td>'; echo '<td><form action="order_process.php" method="post"><input type="submit" name="submit" value="Submit order">'; echo capturepostdata($_POST); echo '</form></td>'; echo '</tr></table>'; include 'footer.php'; ?> I will give you an example. If the individual electronic item is ordered for each choice for a term of 2 years the price should calculate at 15%discount price x 2 for each one and then those three figures totaled (67.15*2)+(16.95*2)+(33.15*2)=234.50. That is the correct calculation and it appears on the order page as the total. When submit is hit $234.51 appears as the total on the order review page. I believe this is because it is just taking the subtotal*15% discount and not doing the calculation the same way. I need the calculation to 1. be correct in both places and 2. calculate from the first methods (the reason for this is complicated, but it has to do with tracking the individual amounts in separate places for credit card purposes.) Sorry if this sounds complicated - it is and I am confused mightily. Any help would be greatly appreciated.
  5. I have this code that sends two emails (among other things). When the order is see on the order review web page it looks fine and the page breaks are there. When the email is sent, the received email does not have the page breaks that should be showing on lines 76-106 of the code below. The mail does get sent and there are no error messages so I am at a loss. <?php include_once("db.php"); include_once("globals.php"); error_reporting(E_PARSE); if (isset($_POST['submit'])) { extract($_REQUEST); if($id_subcount==2){ $discount_rate=DISCOUNT_2Journals; } elseif($id_subcount==3){ $discount_rate=DISCOUNT_3Journals; }else{ $discount_rate=""; } $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $contact_name=$lastname.", ".$firstname; $emails = array(); // The receipt header is only sent to the person that placed the order $receiptHeader = <<<EndOfText <p>Your order from the Journal has been received and we will begin processing it once we have received your payment. Please allow 7-10 days for you payment to be processed and for your order to be carried out. If your order includes online access, you will receive an email containing instructions upon the completion of your order.</p> <p>Thank you and enjoy!</p> <p>Below is the information we received from your submission. If you notice any errors, please contact us immediately so we can correct them.</p> EndOfText; if ($JECT === 'JECTindividual_print') { $JECTorder = 'JECT Individual Print Subscription'; } elseif ($JECT === 'JECTindividual_electronic'){ $JECTorder = 'JECT Individual Electronic Subscription'; } elseif ($JECT === 'JECTinstitutional_electronic'){ $JECTorder = 'JECT Insitutional Subscription'; } elseif ($JECT === 'JECTindividual_combo'){ $JECTorder = 'JECT Individual Combo Subscription'; } elseif ($JECT === 'JECTinstitutional_print'){ $JECTorder = 'JECT Institutional Print Subscription'; } else { $JECTorder = 'JECT subscription'; } if ($JCTL === 'JCTLindividual_print') { $JCTLorder = 'JCTL Individual Print Subscription'; } elseif ($JCTL === 'JCTLindividual_electronic'){ $JCTLorder = 'JCTL Individual Electronic Subscription'; } elseif ($JCTL === 'JCTLinstitutional_electronic'){ $JCTLorder = 'JCTL Insitutional Subscription'; } elseif ($JCTL === 'JCTLindividual_combo'){ $JCTLorder = 'JCTL Individual Combo Subscription'; } elseif ($JCTL === 'JCTLinstitutional_print'){ $JCTLorder = 'JCTL Institutional Print Subscription'; } else { $JCTLorder = 'JCTL subscription'; } if ($LCJ === 'LCJindividual_print') { $LCJorder = 'LCJ Individual Print Subscription'; } elseif ($LCJ === 'LCJindividual_electronic'){ $LCJorder = 'LCJ Individual Electronic Subscription'; } elseif ($LCJ === 'LCJinstitutional_electronic'){ $LCJorder = 'LCJ Insitutional Subscription'; } elseif ($LCJ === 'LCJindividual_combo'){ $LCJorder = 'LCJ Individual Combo Subscription'; } elseif ($LCJ === 'LCJinstitutional_print'){ $LCJorder = 'LCJ Institutional Print Subscription'; } else { $LCJorder = 'LCJ subscription'; } $receipt = $contact_name."\n"; if ($_POST['department']!='') $receipt .= $_POST['department']."\n"; if ($_POST['institution']!='') $receipt .= $_POST['institution']."\n"; $receipt .= $_POST['address']."\n"; $receipt .= $_POST['city'].', '.$_POST['state'].' '.$_POST['zip']."\n"; $receipt .= $_POST['country']."\n"; $receipt .= $_POST['phone']."\n"; $receipt .= $_POST['email']."\n\n"; $order_details=""; $order = '<table border="1"><tr><th>Item</th><th>Base Price<br />(Single Year)</th><th>Your Price<br />(Single Year)</th>Length</th><th>Renewal?</th></tr>'; if($JECT && $JECT!="no"){ if($JECTrenewal){ $rene1="Yes";} else { $rene1="No";} $order_details .=$JECTorder."\n"; $order .= "<tr><td>".$JECTorder."</td><td>".$itemprice1."</td><td>".$jectprice_hidden."</td><td>".$JECTsub."</td><td>".$rene1."</td></tr>"; } if($JCTL && $JCTL!="no"){ if($JCTLrenewal){ $rene2="Yes";} else { $rene2="No";} $order_details .=$JCTLorder."\n"; $order .= "<tr><td>".$JCTLorder."</td><td>".$itemprice2."</td><td>".$jctlprice_hidden."</td><td>".$JCTLsub."</td><td>".$rene2."</td></tr>"; } if($LCJ && $LCJ!="no"){ $order_details .=$LCJorder."\n"; if($LCJrenewal){ $rene3="Yes";} else { $rene3="No";} $order .= "<tr><td>".$LCJorder."</td><td>".$itemprice3."</td><td>".$lcjprice_hidden."</td><td>".$LCJsub."</td><td>".$rene3."</td></tr>"; } $order .="</table>"; $receipt .= $order; $receipt .= "\n\nSubtotal: ".$subtotal; $receipt .= "\n\nDiscount: ".$discount."%"; $receipt .= "\n\nGrand total: ".$total; $receipt .= "\n\nPaying by: ".$payment_method; $message=$receiptHeader.$receipt; if($JCTLrenewal){ $JCTLrenewal="Yes";} else $JCTLrenewal="No"; if($LCJrenewal){ $LCJrenewal="Yes";} else $LCJrenewal="No"; if($JECTrenewal){ $JECTrenewal="Yes";} else $JECTrenewal="No"; $sql_insert="INSERT INTO orders SET type='$subscription_type',order_details='$order_details',subtotal='$subtotal',discount='$discount' ,grand_total='$total',payment_method='$payment_method',contact_name='$contact_name',email='$email',net_addresses='$net_addresses', department='$department',phone='$phone',address='$address',city='$city',state='$state',zip='$zip',country='$country',tech_contact='$tech_contact', tc_phone='$tc_phone',tc_email='$tc_email',tier='$tier',ip='".$_SERVER['REMOTE_ADDR']."',processed_date='".date("Y-m-d H:i:s")."', jectprice='$jectprice_hidden',jctlprice='$jctlprice_hidden',lcjprice='$lcjprice_hidden',jectrenewal='$JECTrenewal',jctlrenewal='$JCTLrenewal',lcjrenewal='$LCJrenewal', jctllength='$JCTLsub',jectlength='$JECTsub',lcjlength='$LCJsub' "; //echo $sql_insert;exit; $result=mysql_query($sql_insert); $ids=mysql_insert_id(); $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers .= "From: Subscription Manager <journals@consulting.com>" . "\r\n"; $subject="Your order has been received"; $subject1="CELTUA Journal order for $contact_name"; @mail($email, $subject, $message, $headers); @mail("journals@consulting.com", $subject1, $message, $headers); if ($_POST['payment_method']!='Credit card (online)') { header("Location: order_thankyou.php"); } else { include 'header.php'; ?> <h1>Journal Order, continued</h1> <h2>Step 2: Make online payment</h2> <p>You will now be taken to a secure payment site to enter your credit card information and complete your online payment.</p> <p><strong>Please have your credit card ready.</strong></p> <p>Please note that if you remain on any one page of the payment site for more than about 10 minutes, even if you are working on it, it will close and send you to our "thank you" page <strong>without</strong> accepting your payment. If this happens, or if you have any other problems or questions, please contact:</p> <p>John Doe</br> Circulation Manager</br> c/o Consulting</br> <form method="post" action="https://commerce.cashnet.com/404Handler/pageredirpost.aspx?virtual=CELTJP"> <p> <?php $x = 1; // incrementing field name/number if($JECT && $JECT!="no"){ $itemcode1=$JECTitemCode; $itemprice1=$jectprice_hidden; echo "<input type='hidden' name='itemcode$x' value='$itemcode1'> <input type='hidden' name='amount$x' value='".round($itemprice1,2)."'>\n"; $x++; } if($JCTL && $JCTL!="no"){ $itemcode1=$JCTLitemCode; $itemprice1=$jctlprice_hidden; echo "<input type='hidden' name='itemcode$x' value='$itemcode1'> <input type='hidden' name='amount$x' value='".round($itemprice1,2)."'>\n"; $x++; } if($LCJ && $LCJ!="no"){ $itemcode1=$LCJitemCode; $itemprice1=$lcjprice_hidden; echo "<input type='hidden' name='itemcode$x' value='$itemcode1'> <input type='hidden' name='amount$x' value='".round($itemprice1,2)."'>\n"; } ?> <input type="hidden" name="ref1type1" value="ID"> <input type="hidden" name="ref1val1" value="<?php echo $ids; ?>"> <input type="hidden" name="ref2type1" value="STORE"> <input type="hidden" name="ref2val1" value="journals"> <input type="hidden" name="ref3type1" value="NAMEFIRST"> <input type="hidden" name="ref3val1" value="<?php echo $firstname; ?>"> <input type="hidden" name="ref4type1" value="NAMELAST"> <input type="hidden" name="ref4val1" value="<?php echo $lastname; ?>"> <input type="submit" value="Make online payment"> </p> </form> <?php include 'footer.php'; } } ?>
  6. mac_gyver, you are a genius! I can't thank you enough. Your original comment got me thinking and I was redoing it and taking out some of the "trees" but was still flailing in the forest. Your code works like a charm and does exactly what I need. This has been a great learning experience for me and hopefully improved my skills.
  7. Thanks mac_gyver, I had a laugh at "too much logic". The notion of too much logic is funny, even though that is exactly the case. I can't use generics and some of the complications arrive from what I am trying to accomplish. The part of the code that contains the switch case is submitting to a payment site and it needs specific information in a specific format. It needs to have the itemcode and the item amount for each thing ordered. What is causing the monkey wrench for me is that is always has to have an item one. So if person orders a single item, that will always be item one. If they order two items, there will be an item one and an item two. Obviously then if they order all three, there will be three itemcodes and threeitem prices. The code I currently have running, for example, always has JECT as itemcode1, JCTL as itemcode2, and LCJ as itemcode3. But if they don't order JECT, then JCTL has to become itemcode1, etc. I know most of this is caused by my noobness, so forgive me if I don't understand exactly the advice you are giving.
  8. Thanks for good catch! One mistake+cut and paste= a mess. I have fixed all the quotes, but my problem still remains the same. It is only outputting itemcode1 and itemprice1.
  9. I have an order process page that uses a switch statement. I am getting no errors and it is partially working. Case 1,2 and 3 work fine. Cases 4-7 only return itemcode1 and itemprice1. It is the correct code and amount, but it doesn't return itemcode/price 2 and/or 3. I know the data is being posted from the order page, so it has to be some flaw in how the switch is working. I am fairly new to php so would appreciate any pointers. The switch starts on line 155. <?php include_once("db.php"); include_once("globals.php"); error_reporting(E_PARSE); if (isset($_POST['submit'])) { extract($_REQUEST); if($id_subcount==2){ $discount_rate=DISCOUNT_2Journals; } elseif($id_subcount==3){ $discount_rate=DISCOUNT_3Journals; }else{ $discount_rate=""; } $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $contact_name=$lastname.", ".$firstname; $emails = array(); // The receipt header is only sent to the person that placed the order $receiptHeader = <<<EndOfText Your order from the Journal has been received and we will begin processing it once we have received your payment. Please allow 7-10 days for you payment to be processed and for your order to be carried out. If your order includes online access, you will recieve an email containing instructions upon the completion of your order. Thank you and enjoy! Below is the information we received from your submission. If you notice any errors, please contact us immediately so we can correct them. <br/><br/><br/> EndOfText; if ($JECT === 'JECTindividual_print') { $JECTorder = 'JECT Individual Print Subscription'; } elseif ($JECT === 'JECTindividual_electronic'){ $JECTorder = 'JECT Individual Electronic Subscription'; } elseif ($JECT === 'JECTinstitutional_electronic'){ $JECTorder = 'JECT Insitutional Subscription'; } elseif ($JECT === 'JECTindividual_combo'){ $JECTorder = 'JECT Individual Combo Subscription'; } elseif ($JECT === 'JECTinstitutional_print'){ $JECTorder = 'JECT Institutional Print Subscription'; } else { $JECTorder = 'JECT subscription'; } if ($JCTL === 'JCTLindividual_print') { $JCTLorder = 'JCTL Individual Print Subscription'; } elseif ($JCTL === 'JCTLindividual_electronic'){ $JCTLorder = 'JCTL Individual Electronic Subscription'; } elseif ($JCTL === 'JCTLinstitutional_electronic'){ $JCTLorder = 'JCTL Insitutional Subscription'; } elseif ($JCTL === 'JCTLindividual_combo'){ $JCTLorder = 'JCTL Individual Combo Subscription'; } elseif ($JCTL === 'JCTLinstitutional_print'){ $JCTLorder = 'JCTL Institutional Print Subscription'; } else { $JCTLorder = 'JCTL subscription'; } if ($LCJ === 'LCJindividual_print') { $LCJorder = 'LCJ Individual Print Subscription'; } elseif ($LCJ === 'LCJindividual_electronic'){ $LCJorder = 'LCJ Individual Electronic Subscription'; } elseif ($LCJ === 'LCJinstitutional_electronic'){ $LCJorder = 'LCJ Insitutional Subscription'; } elseif ($LCJ === 'LCJindividual_combo'){ $LCJorder = 'LCJ Individual Combo Subscription'; } elseif ($LCJ === 'LCJinstitutional_print'){ $LCJorder = 'LCJ Institutional Print Subscription'; } else { $LCJorder = 'LCJ subscription'; } $receipt = $contact_name."\n"; if ($_POST['department']!='') $receipt .= $_POST['department']."\n"; if ($_POST['institution']!='') $receipt .= $_POST['institution']."\n"; $receipt .= $_POST['address']."\n"; $receipt .= $_POST['city'].', '.$_POST['state'].' '.$_POST['zip']."\n"; $receipt .= $_POST['country']."\n"; $receipt .= $_POST['phone']."\n"; $receipt .= $_POST['email']."\n\n"; $order_details=""; $order = '<table border="1"><tr><th>Item</th><th>Base Price<br />(Single Year)</th><th>Your Price<br />(Single Year)</th>Length</th><th>Renewal?</th></tr>'; if($JECT && $JECT!="no"){ if($JECTrenewal){ $rene1="Yes";} else { $rene1="No";} $order_details .=$JECTorder."\n"; $order .= "<tr><td>".$JECTorder."</td><td>".$itemprice1."</td><td>".$jectprice_hidden."</td><td>".$JECTsub."</td><td>".$rene1."</td></tr>"; } if($JCTL && $JCTL!="no"){ if($JCTLrenewal){ $rene2="Yes";} else { $rene2="No";} $order_details .=$JCTLorder."\n"; $order .= "<tr><td>".$JCTLorder."</td><td>".$itemprice2."</td><td>".$jctlprice_hidden."</td><td>".$JCTLsub."</td><td>".$rene2."</td></tr>"; } if($LCJ && $LCJ!="no"){ $order_details .=$LCJorder."\n"; if($LCJrenewal){ $rene3="Yes";} else { $rene3="No";} $order .= "<tr><td>".$LCJorder."</td><td>".$itemprice3."</td><td>".$lcjprice_hidden."</td><td>".$LCJsub."</td><td>".$rene3."</td></tr>"; } $order .="</table>"; $receipt .= $order; $receipt .= "\n\nSubtotal: ".$subtotal; $receipt .= "\n\nDiscount: ".$discount."%"; $receipt .= "\n\nGrand total: ".$total; $receipt .= "\n\nPaying by: ".$payment_method; $message=$receiptHeader.$receipt; if($JCTLrenewal){ $JCTLrenewal="Yes";} else $JCTLrenewal="No"; if($LCJrenewal){ $LCJrenewal="Yes";} else $LCJrenewal="No"; if($JECTrenewal){ $JECTrenewal="Yes";} else $JECTrenewal="No"; $sql_insert="INSERT INTO orders SET type='$subscription_type',order_details='$order_details',subtotal='$subtotal',discount='$discount' ,grand_total='$total',payment_method='$payment_method',contact_name='$contact_name',email='$email',net_addresses='$net_addresses', department='$department',phone='$phone',address='$address',city='$city',state='$state',zip='$zip',country='$country',tech_contact='$tech_contact', tc_phone='$tc_phone',tc_email='$tc_email',tier='$tier',ip='".$_SERVER['REMOTE_ADDR']."',processed_date='".date("Y-m-d H:i:s")."', jectprice='$jectprice_hidden',jctlprice='$jctlprice_hidden',lcjprice='$lcjprice_hidden',jectrenewal='$JECTrenewal',jctlrenewal='$JCTLrenewal',lcjrenewal='$LCJrenewal', jctllength='$JCTLsub',jectlength='$JECTsub',lcjlength='$LCJsub' "; //echo $sql_insert;exit; $result=mysql_query($sql_insert); $ids=mysql_insert_id(); $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers .= "From: lisa@gmail.com <lisa@gmail.com>" . "\r\n"; $subject="Your order has been received"; $subject1="CELTUA Journal order for $contact_name"; @mail($email, $subject, $message, $headers); @mail("lisa@gmail.com", $subject1, $message, $headers); if ($_POST['payment_method']!='Credit card (online)') { header("Location: order_thankyou.php"); } else { include 'header.php'; ?> <h1>Journal Order, continued</h1> <h2>Step 2: Make online payment</h2> <p>You will now be taken to a secure payment site to enter your credit card information and complete your online payment.</p> <p><strong>Please have your credit card ready.</strong></p> <p>Please note that if you remain on any one page of the payment site for more than about 10 minutes, even if you are working on it, it will close and send you to our "thank you" page <strong>without</strong> accepting your payment. If this happens, or if you have any other problems or questions, please contact:</p> <p>Circulation Manager</br> Monroe, OH 45050</br> United States</br></br> <form method="post" action="https://commerce.cashnet.com/404Handler/pageredirpost.aspx?virtual=CELTJP"> <p> <?php switch(true) { case (($JECT && $JECT!="no") && ($JCTL && $JCTL!="yes") && ($LCJ && $LCJ!="yes")): $itemcode1=$JECTitemCode; $itemprice1=$jectprice_hidden; ?> <input type='hidden' name='itemcode1' value=<?php echo $itemcode1; ?>> <input type='hidden' name='amount1' value="<?php echo round($itemprice1,2); ?>"> <?php break; case (($JECT && $JECT!="yes") && ($JCTL && $JCTL!="no") && ($LCJ && $LCJ!="yes")): $itemcode1=$JCTLitemCode; $itemprice1=$jctlprice_hidden; ?> <input type='hidden' name='itemcode1' value=<?php echo $itemcode1; ?>> <input type='hidden' name='amount1' value="<?php echo round($itemprice1,2); ?>"> <?php break; case (($JECT && $JECT!="yes") && ($JCTL && $JCTL!="yes") && ($LCJ && $LCJ!="no")): $itemcode1=$LCJitemCode; $itemprice1=$lcjprice_hidden; ?> <input type='hidden' name='itemcode1' value=<?php echo $itemcode1; ?>> <input type='hidden' name='amount1' value="<?php echo round($itemprice1,2); ?>"> <?php break; case (($JECT && $JECT!="no") && ($JCTL && $JCTL!="no") && ($LCJ && $LCJ!="yes")): $itemcode1=$JECTitemCode; $itemprice1=$jectprice_hidden; $itemcode2=$JCTLitemCode; $itemprice2=$jctlprice_hidden; ?> <input type='hidden' name='itemcode1' value=<?php echo $itemcode1; ?>> <input type='hidden' name='amount1' value=<?php echo round($itemprice1,2); ?>"> <input type='hidden' name='itemcode2' value=<?php echo $itemcode2; ?>> <input type='hidden' name='amount2' value=<?php echo round($itemprice2,2); ?>"> <?php break; case (($JECT && $JECT!="no") && ($JCTL && $JCTL!="yes") && ($LCJ && $LCJ!="no")): $itemcode1=$JECTitemCode; $itemprice1=$jectprice_hidden; $itemcode2=$LCJitemCode; $itemprice2=$lcjprice_hidden; ?> <input type='hidden' name='itemcode1' value=<?php echo $itemcode1; ?>> <input type='hidden' name='amount1' value=<?php echo round($itemprice1,2); ?>"> <input type='hidden' name='itemcode2' value=<?php echo $itemcode2; ?>> <input type='hidden' name='amount2' value=<?php echo round($itemprice2,2); ?>"> <?php break; case (($JECT && $JECT!="yes") && ($JCTL && $JCTL!="no") && ($LCJ && $LCJ!="no")): $itemcode1=$JCTLitemCode; $itemprice1=$jctlprice_hidden; $itemcode2=$LCJitemCode; $itemprice2=$lcjprice_hidden; ?> <input type='hidden' name='itemcode1' value=<?php echo $itemcode1; ?>> <input type='hidden' name='amount1' value=<?php echo round($itemprice1,2); ?>"> <input type='hidden' name='itemcode2' value=<?php echo $itemcode2; ?>> <input type='hidden' name='amount2' value=<?php echo round($itemprice2,2); ?>"> <?php break; case (($JECT && $JECT!="no") && ($JCTL && $JCTL!="no") && ($LCJ && $LCJ!="no")): $itemcode1=$JECTitemCode; $itemprice1=$jectprice_hidden; $itemcode2=$JCTLitemCode; $itemprice2=$jctlprice_hidden; $itemcode3=$LCJitemCode; $itemprice3=$lcjprice_hidden; ?> <input type='hidden' name='itemcode1' value=<?php echo $itemcode1; ?>> <input type='hidden' name='amount1' value=<?php echo round($itemprice1,2); ?>"> <input type='hidden' name='itemcode2' value=<?php echo $itemcode2; ?>> <input type='hidden' name='amount2' value=<?php echo round($itemprice2,2); ?>"> <input type='hidden' name='itemcode3' value=<?php echo $itemcode3; ?>> <input type='hidden' name='amount3' value=<?php echo round($itemprice3,2); ?>"> <?php break; } ?> <input type="hidden" name="ref1type1" value="ID"> <input type="hidden" name="ref1val1" value="<?php echo $ids; ?>"> <input type="hidden" name="ref2type1" value="STORE"> <input type="hidden" name="ref2val1" value="journals"> <input type="hidden" name="ref3type1" value="NAMEFIRST"> <input type="hidden" name="ref3val1" value="<?php echo $firstname; ?>"> <input type="hidden" name="ref4type1" value="NAMELAST"> <input type="hidden" name="ref4val1" value="<?php echo $lastname; ?>"> <input type="submit" value="Make online payment"> </p> </form> <?php include 'footer.php'; } } ?>
  10. I fixed line 9 ($JCTLitemCode), and I am now getting returns on both itemcode 1 and 2, but item 1 is duplicating. Here is the result: <input type='hidden' name='itemcode1' value=5612CW> <input type='hidden' name='amount1' value=71.1"> <input type='hidden' name='itemcode1' value=5612CW> <input type='hidden' name='amount1' value=71.1"> <input type='hidden' name='itemcode2' value=9113CW> <input type='hidden' name='amount2' value=17.96"> Why is itemcode1 repeating? I know it is obvious, just not to me. Thanks for any help.
  11. HI, I am fairly new to PHP and I am working on a complicated ifelse statement. I am getting the first part of it to work (i.e. showing itemcode1 and itemvalue1, but I can't get it to echo the item code2/value2. I know it is because of incorrect syntax in lines 3-14, but I can't figure out how to make it work. I have tried to research it, but nothing I can find speaks to having two outcomes. Thanks ahead for any help. }elseif(($JECT && $JECT!="no") && ($JCTL && $JCTL!="no") && ($LCJ && $LCJ!="yes")) { $itemcode1=$JECTitemCode; if($jectprice_hidden){ $itemprice1=$jectprice_hidden; } else{ $itemprice1=$itemprice1; } $itemcode2=JCTLitemCode; if($jctlprice_hidden){ $itemprice2=$jctlprice_hidden; } else{ $itemprice2=$itemprice2; } ?> <input type='hidden' name='itemcode1' value=<?php echo $itemcode1; ?>> <input type='hidden' name='amount1' value=<?php echo round($itemprice1,2); ?>"> <input type='hidden' name='itemcode2' value=<?php echo $itemcode2; ?>> <input type='hidden' name='amount2' value=<?php echo round($itemprice2,2); ?>"> <?php } ?>
  12. I have this form code, written by another person. Currently it looks to see if the first value($JECT) is empty. If not it creates an itemcode1. If it is empty, it skips to the next value($JCTL) and does the same, except it makes it itemcode2. I need for the first one($JECT) to be itemcode1 if not empty, the second($JCTL) to be itemcode1 if the first is empty and itemcode2 if it is not. The same for the third(LCJ) -item 1, 2, or 3 depending on the values of the others. So basically, I always need to have an itemcode1 for processing and possibly an itemcode2 or 3. I hope this is clearer than it sounds to me. Thanks for any help! <form method="post" action="URLHERE"> <p> <?php if($JECT && $JECT!="no"){ $itemcode1=$JECTitemCode; if($jectprice_hidden){ $itemprice1=$jectprice_hidden; } else { $itemprice1=$itemprice1; } ?> <input type='hidden' name='itemcode1' value=<?php echo $itemcode1; ?>> <input type='hidden' name='amount1' value="<?php echo round($itemprice1,2); ?>"> <?php } ?> <?php if($JCTL && $JCTL!="no"){ $itemcode2=$JCTLitemCode; if($jctlprice_hidden){ $itemprice2=$jctlprice_hidden; } else { $itemprice2=$itemprice1; } ?> <input type='hidden' name='itemcode2' value=<?php echo $itemcode2; ?>> <input type='hidden' name='amount2' value="<?php echo round($itemprice2,2); ?>"> <?php } ?> <?php if($LCJ && $LCJ!="no"){ $itemcode3=$LCJitemCode; if($lcjprice_hidden){ $itemprice3=$lcjprice_hidden; } else { $itemprice3=$itemprice1; } ?> <input type='hidden' name='itemcode3' value=<?php echo $itemcode3; ?>> <input type='hidden' name='amount3' value="<?php echo round($itemprice3,2); ?>"> <?php } ?> <input type="hidden" name="ref1type1" value="ID"> <input type="hidden" name="ref1val1" value="<?php echo $ids; ?>"> <input type="hidden" name="ref2type1" value="STORE"> <input type="hidden" name="ref2val1" value="journals"> <input type="hidden" name="ref3type1" value="NAMEFIRST"> <input type="hidden" name="ref3val1" value="<?php echo $firstname; ?>"> <input type="hidden" name="ref4type1" value="NAMELAST"> <input type="hidden" name="ref4val1" value="<?php echo $lastname; ?>"> <input type="submit" value="Make online payment"> </p> </form>
  13. Problem resolved! At one point it enters invited as a hidden value so all I did was change the stop alert line to: if (realForm.type.value != "invited" && realForm.infocheck.checked == false) {return stopWithAlert("Please read and agree to verification statement.", realForm.infocheck);} Works like a charm!
  14. I have a form I am using. You can access this form from two different urls. url1.com/form.php and url1.com/form.php?invited Depending on the url used to access the form, I have a section either show or not show. The code for this is: <?php if (!$invited) echo '<p><strong><input type="checkbox" id="infocheck" name="infocheck" value="Yes" > Verification Statement: "I verify that I have followed the proposal guidelines above and that my proposal includes citations of relevant literature and a reference list in APA format, a discussion of evidence of learning outcomes, and a description of how the session will be run."</strong></p>'; ?> What I am having trouble with is a stop alert for verification in my javascript. I currently have: if (realForm.infocheck.checked == false) {return stopWithAlert("Please read and agree to verification statement.", realForm.infocheck);} How do I tell this to only do this if that section of the form is available and checked? When visible it has to be checked to proceed, when not visible (ie for an invited person with ?invited in the query string, I don't want it to even check. Javascript is not my strong point. Thanks for any help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.