/    Sign up×
Community /Pin to ProfileBookmark

Hi

I’m trying using the if situation to show a the name of a country and a html table in the following condition:

<table width=”100%” border=”0″ cellspacing=”2″ cellpadding=”0″>

<? if ($country!=” “) { ?>

<tr>
<td width=’42%’>
<table width=’264′ height=’26’ border=’0′ cellpadding=’0′ cellspacing=’0′>
<tr>
<td background=’images/pict_66.jpg’>

<table width=’264′ height=’26’ border=’0′ cellpadding=’0′ cellspacing=’0′>
<tr>
<td width=’164′ align=’right’ valign=’middle’><font face=’arial’ color=’#999999′ size=’1′><? $lang_country ?>&nbsp;</font></td>
<td width=’100′ align=’left’ valign=’middle’><font face=’arial’ size=’1′ color=’#000000′>&nbsp;
<? $country ?>
</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height=’2′><img src=’images/pict_spacer.gif’ width=’264′ height=’2′ /></td>
</tr>
</table>

<? } ?>

But it shows the table without info, when it suppose not show the table either.

thanks

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@aj_nscSep 27.2008 — Show us the php code before that, what is your variable $country supposed to be if it is not an actual country? Is it supposed to be empty? Is it supposed to be a single whitespace character (which is what you are comparing it to right now)?

I would bet that if you replace your if statement with:
[code=php]
if(empty($country)) {
[/code]


Then it would work, but to be precise, we really need to see the code where you actually set your $country variable.
×

Success!

Help @JoseSilva spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...