Jump to content

[SOLVED] Or statement not working


acctman

Recommended Posts

The statement below works fine when I do if (<%m_country%> != "US") { but when I add the || it doesn't work.

 

if (<%m_country%> != "US" || <%m_country%> != "CA") {		
		echo '<SELECT onChange="HandleStateApearence(this.selectedIndex, null, $(\'state_\'), $(\'state_3\'), $(\'state_2\'), null, 0, 38, false)" name=add[country]>';
		global $countries; foreach ($countries as $key => $value) echo "<option value='".$key."'".(<%m_country%> == $key ? ' selected="selected"' : '').">".htmlentities($value['name'],ENT_QUOTES)."</option>\n";
		echo '</SELECT>';
		echo '<span id=\'state_\' style="DISPLAY:none; font-weight:bold;"> State:  </span>';
		echo '<SELECT id=state_2 style="DISPLAY:none" name="c_state">';
		global $cstates; foreach ($cstates['CA'] as $key => $value) echo "<option value='".$key."'".(<%m_state%> == $key ? ' selected="selected"': '').">".htmlentities($value,ENT_QUOTES)."</option>\n";
		echo '</SELECT>';
		echo '<SELECT id=state_3 style="DISPLAY:none; name="u_state">';
		global $states; foreach ($states['US'] as $key => $value) echo "<option value='".$key."'".(<%m_state%> == $key ? ' selected="selected"': '').">".htmlentities($value,ENT_QUOTES)."</option>\n";
		echo '</SELECT>';
	}

Link to comment
https://forums.phpfreaks.com/topic/128143-solved-or-statement-not-working/
Share on other sites

I'm not even sure you should be using the or. So you want to check m_country and if it isn't us or ca, then run the script.

 

Have you tried && operator.

 

<%m_country%> != "US" && <%m_country%> != "CA"

 

Might work..hope that helps.

I'm not even sure you should be using the or. So you want to check m_country and if it isn't us or ca, then run the script.

 

Have you tried && operator.

 

<%m_country%> != "US" && <%m_country%> != "CA"

 

Might work..hope that helps.

 

thanks && worked... i was writting the statement work.

Archived

This topic is now archived and is closed to further replies.

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