I've been trying to customize a portion of PHP script for this.
I want it to display image if the input value is in number (1, 3, 20, 99, or etc). Else, I want it to display text if the input value is in text (lorem, randomtext, or etc). And I want it to display nothing if the value is 0.
But I keep getting it wrong. It always displays text, no matter what the input value is.
Here is the PHP code:
if ( $topic['topic_icon']     = $topic['icon_id']  ) {
                if (is_numeric($topic['icon_id'])) {
                "<img src='".$ibforums->vars['img_url']."/icon{$topic['icon_id']}.gif' alt='{$topic['icon_id']}' />";
                } else {
                "<span class='text-icon {$topic['icon_id']}'>{$topic['icon_id']}</span>";
                }
            } else {
             "";
             }
And here is a portion of the HTML where user can input the value (it's with radio button, the <form /> tag is not included since it's a part of huge chunk of code):
<input type="radio" class="radiobutton" name="iconid" value="15" />  <img src="{$ibforums->vars['img_url']}/icon15.gif"  align='middle' alt='' />
<input type="radio" class="radiobutton" name="iconid" value="16" />  <img src="{$ibforums->vars['img_url']}/icon16.gif"  align='middle' alt='' />
<input type="radio" class="radiobutton" name="iconid" value="17" />  <img src="{$ibforums->vars['img_url']}/icon17.gif"  align='middle' alt='' /><br />
<input type="radio" class="radiobutton" name="iconid" value="SPRING" />  <span class='text-icon SPRING'>SPRING</span>
<input type="radio" class="radiobutton" name="iconid" value="SUMMER" />  <span class='text-icon SUMMER'>SUMMER</span>
<input type="radio" class="radiobutton" name="iconid" value="AUTUMN" />  <span class='text-icon AUTUMN'>AUTUMN</span>
<input type="radio" class="radiobutton" name="iconid" value="WINTER" />  <span class='text-icon WINTER'>WINTER</span><br />
<input type="radio" class="radiobutton" name="iconid" value="0" checked="checked" />  [ Use None ]
The column used in MySQL table (it's icon_id) is set as varchar(64).
I apologize for the long title...
 
     
    