/    Sign up×
Community /Pin to ProfileBookmark

Checking Checkbox Status

Hi

Ive got a form with only one checkbox. On my display page i want to check whether or not the checkbox is checked, if it is then i want to display a pic if not no pic.

I have the below code but think i am going wrong with checking whether the check box is NULL. The checkbox is $row[$callindex]

[code] for ( $i=1; $i <= $num_rows; $i++ )
{
$row = mysql_fetch_row($result);
$comindex = 2;
$callindex = 3;

echo ‘<tr>’;
// Loop through each column
for ( $j=0; $j < $num_cols – 1; $j++ )
{
if ($row[$j] == NULL)
{ echo ‘<td>&nbsp;</td>’;
}
else
{ if ($j==$comindex && $row[$callindex] != NULL)
{ echo ‘<td><b><img src=”../../images/mobile.jpg”></b>&nbsp;’.htmlentities( $row[$j] ).'</td>’;
}
else
{
echo ‘<td>’.$row[$j].'</td>’;
}
}
}
}[/code]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@bazjonesauthorFeb 17.2005 — Ive figured it out now people


Thanks Anyways

Baz
×

Success!

Help @bazjones 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.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

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