Jump to content

Another if Issue


vicdesigns

Recommended Posts

This one is pretty weird. I hope someone here can shed some light on it because it has me completely baffled.

Basically, I want to give the admin the option to disable or enable a footer link.

 

Here is the parameter:

 

	$params["show_footer"]     = isset($_POST['show_footer']) ? prepare_input($_POST['show_footer']) : $objSettings->GetParameter("show_footer");

 

The settings code:

<tr>
			<td align="left" width="150px">'._SHOW_FOOTER.':</td>
			<td align="left" colspan="2">
				<select name="show_footer">
					<option '.(($params["show_footer"] == "1") ? "selected" : "").' value="1">'._YES.'</option>
					<option '.(($params["show_footer"] == "0") ? "selected" : "").' value="0">'._NO.'</option>
				</select>					
			</td>
		</tr>

 

And, the code to either disable or enable the footer text:

 

				if($objSettings->GetParameter("show_footer") != "1"){
echo '<br><br><font color="#FFFFFF">Footer Text Here.';}
else {
echo '<br><br>';};?>

 

What has me stumped is, in the admin settings, if I select Yes (to allow the footer to be displayed) the footer is disabled. If I select No, it is enabled. I can't for the life of me figure it out.

 

Any help is greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/239787-another-if-issue/
Share on other sites

This says if the value is NOT 1, show the 'footer text here' block, which is the opposite of what it appears you want done as indicated by your <select> field . . .

 

if($objSettings->GetParameter("show_footer") != "1") {
     echo '<br><br><font color="#FFFFFF">Footer Text Here.'; 
} else {
     echo '<br><br>';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/239787-another-if-issue/#findComment-1231777
Share on other sites

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.