Visible table based on a variable?

Hi, I was wondering of someone could provide a basic method / example of allowing tables to be visible or not depending on a numeric variable.

So, if the variable is 1 then table 1 is visible, if its 2 then table is visible and 1 and 3 aren’t.

Hopefully that makes sense.

The modulus operator % sounds like the thing to get the job done. :wink:

visible.php
[php]<?php
if (isset($_POST[‘submit’]) && $_POST[‘submit’] == ‘Enter’)
$table = $_POST[‘tableNum’];
?>
<!doctype html>

Visible #tableNum { width: 50px; padding: 5px; } .box {display:block;width:200px;height:200px;background-color:#F60;margin:120px auto;} Enter Table Number:

>
[/php]

*Strider64. That wont work.

It is as simple as:
[php]<?php
$var = 1;

if ($var == 1)
{
// Table 1 here
}
elseif ($var == 2)
{
// Table 2 here
}
elseif ($var == 3)
{
// Table 3 here
}
else
{
//No table selected
}
?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service