/    Sign up×
Community /Pin to ProfileBookmark

Show data if checkbox is checked

I have an instance where I need to show two links if their boolean value has been set to true. The fields are checkr and checks which in MySQL are TINYINT(1). So it would go something like this:
if (checkr && checks = true) //both have to be true, not just one
echo $checkr with link(popup window)
echo $checks with link(popup window)

So I have two different attemps, but not really sure either one is correct, I know I’m missing something

[code=php]
if ($checkr && $checks)
{
$resstat .= ‘ – ‘ . ‘<a href=”link?id=’ . $row[‘field1’] . ‘”>’link1</a>” . ‘ – ‘ . ‘<a href=”link?id=’ . $row[‘field2’] . ‘”>’link2</a>” . ‘<br>’;
echo $resstat;
}
[/code]
[code=php]
if (isset($_GET[‘checkr’],[‘checks’]))
{
$resstat .= ‘ – ‘ . ‘<a href=”link?id=’ . $row[‘field1’] . ‘”>’link1</a>” . ‘ – ‘ . ‘<a href=”link?id=’ . $row[‘field2’] . ‘”>’link2</a>” . ‘<br>’;
echo $resstat;
}
[/code]

Also, the fields checkr, checks, field1, and field2 should all change relative to the value of $personID which is passed before this if statement.
Any ideas or hints are appreciated, thanks!

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@sitehatcheryApr 09.2006 — if ($checkr && $checks==1)
Copy linkTweet thisAlerts:
@balloonbuffoonApr 09.2006 — Actually, if you're just trying to see if both are true, this [I]will[/I] work:
[code=php]if ($checkr && $checks)[/code]
Have you actually tried it yet?

--Steve
Copy linkTweet thisAlerts:
@sitehatcheryApr 09.2006 — You're right. The second example would not work because even setting one of the variables to 0, would still set the variable. But, the first does work.
×

Success!

Help @SpikeWeb 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 5.9,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...