Jump to content

P0PZ

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by P0PZ

  1. ok here is some code... this is the code i tried for the switch function <?php if(!isset($_GET['id'])) { $_GET['id'] = NULL; } ?> <div class="center"> <a href="book.php?book=title">title</a> <a href="book.php?book=All"></a> </div> <div class="left"> <?php switch (@$_GET['book']) { case "All": $result = mysql_query("SELECT * FROM simple_search"); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {echo "<ul><li><a href=\"?id={$row['stitle']}\">"; echo $row['stitle']; echo "</a></li></ul>";} break; case "title": $result = mysql_query("SELECT * FROM simple_search WHERE type='title'"); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {echo "<ul><li><a href=\"?id={$row['stitle']}\">"; echo $row['stitle']; echo "</a></li></ul>";} break; } ?> </div> <div class="right"> <?php $id = $_GET['id']; $result = $database->query("SELECT * FROM simple_search WHERE stitle='$id'") or die ("cant do it"); while ($rows = mysql_fetch_array($result, MYSQL_ASSOC)) { echo " <table border\"1\" width=\"100%\"> <tr> <td width=\"20%\" valign=\"top\">{$rows['stitle']}</td> <td width=\"20%\" valign=\"top\">{$rows['sdescription']}</td> <td width=\"20%\" valign=\"top\">{$rows['type']}</td> <td width=\"40%\" valign=\"top\">{$rows['sbody']}</td> <tr> </table>"; }?> and here is the code i tried for the form action function <div class="middle"> <form method="get" action="book.php"> <input type="submit" name="book" value="All" /> <input type="submit" name="book" value="title" /> </form> </div> <div class="left"> <?php if(isset($_GET['book'])){ $action = $_GET['book']; } else { $action = 'All'; } if(!isset($_GET['id'])) { $_GET['id'] = NULL; } $result = mysql_query("SELECT * FROM simple_search"); while ($row2 = mysql_fetch_array($result, MYSQL_ASSOC)) if($action == 'All') { echo "<ul>"; echo "<li>"; echo "<a href=\"?id={$row2['stitle']}\">"; echo $row2['stitle']; echo "</a>"; echo "</li>"; echo "</ul>"; } $result = mysql_query("SELECT * FROM simple_search WHERE type='title'"); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) if($action == 'title') { echo "<ul>"; echo "<li>"; echo "<a href=\"?id={$row['stitle']}\">"; echo $row['stitle']; echo "</a>"; echo "</li>"; echo "</ul>"; } ?> </div> <div class="right"> <?php $id = $_GET['id']; $result = $database->query("SELECT * FROM simple_search WHERE stitle='$id'") or die ("cant do it"); while ($rows = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<table border\"1\" width=\"100%\"> <tr> <td width=\"20%\" valign=\"top\">{$rows['stitle']}</td> <td width=\"20%\" valign=\"top\">{$rows['sdescription']}</td> <td width=\"20%\" valign=\"top\">{$rows['type']}</td> <td width=\"40%\" valign=\"top\">{$rows['sbody']}</td> <tr> </table>"; }?> both sets of code work the same way links in div1 (middle) display dynamic links in div2 from mysql field (left) display mysql row in div3 (right). sorry for not adding the code to my first post. P0PZ
  2. Hello Im trying to work out how i can display 2 sets of dynamic content depending on a link clicked. Im currently using css, html, php & mysql. I have my database set with a unique id for each row of data. Heres what i am trying to get to work. I have links in div1 that pull info depending on different fields and display it in div2 (eg link 'title' will pull down the 'title' field, link 'author' would pull down the 'author' field) the info displayed in div2 is a series of dynamic links that i want to display the content of that row in div3 (eg the link 'title' 'math' would display all content from its row using the unique id) i am able to set up the links (div1) to display content in div2 and the div2 dynamic links to display content in div3. But when ever i click a dynamic div2 link it displays the info in div3(like it should) but div 2 reverts back to default(which it shouldnt). how can i display the div2 dynamic links while displaying div3 content? ive tried using a switch statement and also a form action statment ( if(action == title){display info}; ) is there something i can try to get this to work... i know it can be done using html frames but i want to stay away from frames as they are just crap (well i think they are) any help or advice would be great. cheers P0PZ ps. i hope i have explained what im trying to achieve ok... if i havent just let me know and ill try again.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.