Jump to content

Need help with IFELSE doing two things


learningcurve
Go to solution Solved by Maq,

Recommended Posts

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
}
?>
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.