learningcurve Posted July 1, 2013 Share Posted July 1, 2013 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> Quote Link to comment https://forums.phpfreaks.com/topic/279761-always-need-an-item-1/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.