co.ador Posted September 8, 2009 Share Posted September 8, 2009 Guys I am facing a display problem which I know it will be resolved with a If else statement or some condition of that kind. I want that if user x click one of the submenus of the first query at or first display then user x will be able to see only first display layout below the while loop and if user x click in the subjects second display then user x will be able to see only the layout in the second display and not both how it is displaying now. as I said before right now the way it is working is that if user x click on one of the submenu in the first display then the layout of the first display appear and the layout of the second display as well and I only want it to show the one the user required first layout or second layout depending where the user clicked in other word "one at the time".Right now when user x click on the subjects 'second display layout' or Subjects menu then the layout of the second display appear this time not both together I guess becuase after the second query there is not more coding. Can you help me to display one at the time e.g if user x clicked on the subject menu then only the layout of subject menu will appear or if user x clicked on the submenu menu then only the layout of the submenu menu will appear. help please. <?php $submenu = false; $cat = isset($_GET['subject']) && is_numeric($_GET['subject'])?$_GET['subject']:null; $prod = isset($_GET['menu']) && is_numeric($_GET['menu'])?$_GET['menu']:null; $menu_type = isset($_GET['menu_type']) && is_string($_GET['menu_type'])?$_GET['menu_type']:null ?> //First Display <?php $query = "SELECT id, submenus, image, FROM submenu WHERE id= " . (int) $_GET['menu']; echo $query; $result = mysql_query($query, $connection); while ($content = mysql_fetch_array($result)) { echo '<table border="0" cellspacing="0" cellpadding="0" width="559" style="position:relative; left:199; top:190px; font-size:14px;"> <tr> <td height="37" background="images/bar02.gif" width="50%"><p class="titleb"><img src="images/e03.gif" alt="" width="12" height="14" border="0" align="absbottom"> COMPANY TEXT GOES HERE</p></td> <td bgcolor="#666666"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> <td height="37" background="images/bar02.gif" width="50%"><p class="titleb"><img src="images/e03.gif" alt="" width="12" height="14" border="0" align="absbottom"> COMPANY TEXT GOES HERE</p></td> </tr> <tr valign="top"> <td> <br> <img src="images/temp01.gif" width="78" height="164" alt="" border="0" hspace="15" align="left"> <p class="t01"><img src="images/e_punct_b.gif" width="5" height="5" alt="" border="0" align="absmiddle"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh commodo consequat.amet, consectetuer adipiscing elit, sed diam consectetuer adipiscing elit, sed diam nonummy nibh commodo consequat.</p> <p class="t01" align="right"><a href="http://atat.ro">Read more</a></p> </td> <td bgcolor="#666666"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> <td> <br> <img src="images/temp02.gif" alt="" width="133" height="172" hspace="10" border="0" align="left"> <p class="t01"><img src="images/e_punct_b.gif" width="5" height="5" alt="" border="0" align="absmiddle"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh commodo consequat.amet, consectetuer adipiscing consequat.</p> <p class="t01" align="right"><a href="http://atat.ro">Read more</a></p> </td> </tr> <tr> <td background="images/bar03.gif" height="57"> <p class="left" style="padding-bottom: 0px;"><img src="images/e_punct_w.gif" width="5" height="5" alt="" border="0" align="absmiddle"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed commodo consequat.</p> <p class="left" style="padding-bottom: 0px;" align="right"><a href="http://atat.ro">Read more</a></p> </td> <td bgcolor="#FFFFFF"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> <td background="images/bar03.gif" height="57"> <p class="left" style="padding-bottom: 0px;"><img src="images/e_punct_w.gif" width="5" height="5" alt="" border="0" align="absmiddle"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed commodo consequat.</p> <p class="left" style="padding-bottom: 0px;" align="right"><a href="http://atat.ro">Read more</a></p> </td> </tr> <tr> <td colspan="3" background="images/bar01.gif" height="28"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> </tr> </table>'; } ?> // second display <?php $query2 = "SELECT id, Subject, image, FROM subjects WHERE id= " . (int) $_GET['subject']; echo $query2; $result2 = mysql_query($query2, $connection); { echo '<table border="0" cellspacing="0" cellpadding="0" width="559" style="position:relative; left:199; top:190px; font-size:14px;"> <tr> <td height="37" background="images/bar02.gif" width="50%"><p class="titleb"><img src="images/e03.gif" alt="" width="12" height="14" border="0" align="absbottom"> COMPANY TEXT GOES HERE</p></td> <td bgcolor="#666666"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> <td height="37" background="images/bar02.gif" width="50%"><p class="titleb"><img src="images/e03.gif" alt="" width="12" height="14" border="0" align="absbottom"> COMPANY TEXT GOES HERE</p></td> </tr> <tr valign="top"> <td> <br> <img src="images/temp01.gif" width="78" height="164" alt="" border="0" hspace="15" align="left"> <p class="t01"><img src="images/e_punct_b.gif" width="5" height="5" alt="" border="0" align="absmiddle"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh commodo consequat.amet, consectetuer adipiscing elit, sed diam consectetuer adipiscing elit, sed diam nonummy nibh commodo consequat.</p> <p class="t01" align="right"><a href="http://atat.ro">Read more</a></p> </td> <td bgcolor="#666666"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> <td> <br> <img src="images/temp02.gif" alt="" width="133" height="172" hspace="10" border="0" align="left"> <p class="t01"><img src="images/e_punct_b.gif" width="5" height="5" alt="" border="0" align="absmiddle"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh commodo consequat.amet, consectetuer adipiscing consequat.</p> <p class="t01" align="right"><a href="http://atat.ro">Read more</a></p> </td> </tr> <tr> <td background="images/bar03.gif" height="57"> <p class="left" style="padding-bottom: 0px;"><img src="images/e_punct_w.gif" width="5" height="5" alt="" border="0" align="absmiddle"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed commodo consequat.</p> <p class="left" style="padding-bottom: 0px;" align="right"><a href="http://atat.ro">Read more</a></p> </td> <td bgcolor="#FFFFFF"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> <td background="images/bar03.gif" height="57"> <p class="left" style="padding-bottom: 0px;"><img src="images/e_punct_w.gif" width="5" height="5" alt="" border="0" align="absmiddle"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed commodo consequat.</p> <p class="left" style="padding-bottom: 0px;" align="right"><a href="http://atat.ro">Read more</a></p> </td> </tr> <tr> <td colspan="3" background="images/bar01.gif" height="28"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> </tr> </table>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/173586-display-issues/ Share on other sites More sharing options...
co.ador Posted September 8, 2009 Author Share Posted September 8, 2009 Guys I am facing a display problem which I know it will be resolved with a If else statement or some condition of that kind. I want that if user x click one of the submenus of the first query at or first display then user x will be able to see only first display layout below the while loop and if user x click in the subjects second display then user x will be able to see only the layout in the second display and not both how it is displaying now. as I said before right now the way it is working is that if user x click on one of the submenu in the first display then the layout of the first display appear and the layout of the second display as well and I only want it to show the one the user required first layout or second layout depending where the user clicked in other word "one at the time".Right now when user x click on the subjects 'second display layout' or Subjects menu then the layout of the second display appear this time not both together I guess becuase after the second query there is not more coding. Can you help me to display one at the time e.g if user x clicked on the subject menu then only the layout of subject menu will appear or if user x clicked on the submenu menu then only the layout of the submenu menu will appear. help please. <?php $submenu = false; $cat = isset($_GET['subject']) && is_numeric($_GET['subject'])?$_GET['subject']:null; $prod = isset($_GET['menu']) && is_numeric($_GET['menu'])?$_GET['menu']:null; $menu_type = isset($_GET['menu_type']) && is_string($_GET['menu_type'])?$_GET['menu_type']:null ?> //First Display <?php $query = "SELECT id, submenus, image, FROM submenu WHERE id= " . (int) $_GET['menu']; echo $query; $result = mysql_query($query, $connection); while ($content = mysql_fetch_array($result)) { echo '<table border="0" cellspacing="0" cellpadding="0"> <td>Something</td></table>'; } ?> // second display <?php $query2 = "SELECT id, Subject, image, FROM subjects WHERE id= " . (int) $_GET['subject']; echo $query2; $result2 = mysql_query($query2, $connection); { echo '<table border="0" cellspacing="0" cellpadding="0" > <td></td> </table>'; } ?> The code above it's more readable... Quote Link to comment https://forums.phpfreaks.com/topic/173586-display-issues/#findComment-914987 Share on other sites More sharing options...
mikesta707 Posted September 8, 2009 Share Posted September 8, 2009 how do you tell which link has been pressed? is there a get variable passed or something? Quote Link to comment https://forums.phpfreaks.com/topic/173586-display-issues/#findComment-914994 Share on other sites More sharing options...
co.ador Posted September 8, 2009 Author Share Posted September 8, 2009 the script below is in charge of passing the links to show first display or second display. <?php $sql = 'SELECT id,Subject FROM subjects;'; $result = mysql_query($sql); if($result && mysql_num_rows($result)!=0) { echo '<ul class="nav-categories">'; while($row = mysql_fetch_assoc($result)) { $uri = 'example.php?subject='.urlencode($row['id']); $class = !is_null($cat) && $cat==$row['id']?' class="selected"':''; echo "\t",'<li',$class,'><a href="',$uri,'">',$row['Subject'],'</a>'; if($submenu == false && !is_null($cat) && $cat == $row['id']) { $sql2 = 'SELECT id,shoename FROM subemenumenu WHERE menusubject_id = '.mysql_real_escape_string($cat).';'; $result2 = mysql_query($sql2); if($result2 && mysql_num_rows($result2)!=0) { echo "\n\t\t",'<ul class="submenu">',"\n"; while($row2 = mysql_fetch_assoc($result2)) { $uri2 = $uri2.'&menu='.urlencode($row2['id']); $class2 = !is_null($prod) && $prod==$row2['id']?' class="selected"':''; echo "\t\t\t",'<li',$class2,'><a href="',$uri2,'">',$row2['shoename'].'</a></li>',"\n"; } echo "\t\t",'</ul> <!-- end of ul.submenu -->',"\n"; } $submenu = true; } echo '</li>',"\n"; } echo '</ul> <!-- end of ul#nav-categories -->',"\n"; } ?> <?php $submenu = false; $cat = isset($_GET['subject']) && is_numeric($_GET['subject'])?$_GET['subject']:null; $prod = isset($_GET['menu']) && is_numeric($_GET['menu'])?$_GET['menu']:null; $menu_type = isset($_GET['menu_type']) && is_string($_GET['menu_type'])?$_GET['menu_type']:null ?> <?php $sql = 'SELECT id,Subject FROM subjects;'; $result = mysql_query($sql); if($result && mysql_num_rows($result)!=0) { echo '<ul class="nav-categories">'; while($row = mysql_fetch_assoc($result)) { $uri = 'example.php?subject='.urlencode($row['id']); $class = !is_null($cat) && $cat==$row['id']?' class="selected"':''; echo "\t",'<li',$class,'><a href="',$uri,'">',$row['Subject'],'</a>'; if($submenu == false && !is_null($cat) && $cat == $row['id']) { $sql2 = 'SELECT id,shoename FROM subemenumenu WHERE menusubject_id = '.mysql_real_escape_string($cat).';'; $result2 = mysql_query($sql2); if($result2 && mysql_num_rows($result2)!=0) { echo "\n\t\t",'<ul class="submenu">',"\n"; while($row2 = mysql_fetch_assoc($result2)) { $uri2 = $uri2.'&menu='.urlencode($row2['id']); $class2 = !is_null($prod) && $prod==$row2['id']?' class="selected"':''; echo "\t\t\t",'<li',$class2,'><a href="',$uri2,'">',$row2['shoename'].'</a></li>',"\n"; } echo "\t\t",'</ul> <!-- end of ul.submenu -->',"\n"; } $submenu = true; } echo '</li>',"\n"; } echo '</ul> <!-- end of ul#nav-categories -->',"\n"; } ?> //First Display <?php $query = "SELECT id, submenus, image, FROM submenu WHERE id= " . (int) $_GET['menu']; echo $query; $result = mysql_query($query, $connection); while ($content = mysql_fetch_array($result)) { echo '<table border="0" cellspacing="0" cellpadding="0"> <td>Something</td></table>'; } ?> // second display <?php $query2 = "SELECT id, Subject, image, FROM subjects WHERE id= " . (int) $_GET['subject']; echo $query2; $result2 = mysql_query($query2, $connection); { echo '<table border="0" cellspacing="0" cellpadding="0" > <td></td> </table>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/173586-display-issues/#findComment-915028 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.