Hello ,

I'm trying to set 3 different tables using url variable from a differnt page.
When a certain var is selected , the page should display a certain table.

each table is differed by name and im using an IF statement.
My issue is that only the first echo'd table is being displayed....


As you see in my code , I'm trying to get the 'catagory'
variable from the URL and using it to
display the right table.
The .... is the rest of the table so its not relevant to show it here..
Any suggestions ?

update_ads.php //the page name
....
<?php 

$name = $_GET['record'];
$the_catagory = $_POST['catagory']; //the variable from the
 //other page :(<a href="update_ads.php?record=<?php echo $players_name?>&catagory=players">)


if ($the_catagory = "players"){

echo'
'.$name.'
<!-- players section for update -->
<div>
...

}

 elseif ($the_catagory = "events") {

echo'
'.$name.'
<!-- bands section for update -->
<div>
....
}

else if ($the_catagory = "sales"){

 echo'
'.$name.'
<!-- sales section for update -->
<div>
}
.....

Recommended Answers

All 5 Replies

Replace = by == in your comparison statements.

When replacing = with == it shows me nothing...

view your source - if the source code of your webpage contains the reqd div then its html problem

else its php if,else braces problem

your logic seems to be right

Following works for me fine:

$name = $_GET['record'];
$the_catagory = $_POST['catagory']; //the variable from the


if ($the_catagory == "players")  {

} elseif ($the_catagory == "events") {

} elseif ($the_catagory == "sales") {

}

OK. Now I've got it . There were 2 main issue:
1. I've changed it to == instead og =..
2. From the calling page , I've deleted the 2nd variable '?' mark..
<a href="update_ads.php?record=<?php echo $band_id?>&?catagory=events" >ערוך</a>
Thanks a lot ...Issue solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.