learningcurve Posted July 11, 2013 Share Posted July 11, 2013 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 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/280082-need-help-with-ifelse-doing-two-things/ Share on other sites More sharing options...
learningcurve Posted July 11, 2013 Author Share Posted July 11, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/280082-need-help-with-ifelse-doing-two-things/#findComment-1440380 Share on other sites More sharing options...
Solution Maq Posted July 11, 2013 Solution Share Posted July 11, 2013 This line: $itemcode2=JCTLitemCode; $itemcode2=$JCTLitemCode; Quote Link to comment https://forums.phpfreaks.com/topic/280082-need-help-with-ifelse-doing-two-things/#findComment-1440396 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.