View Full Version : disappearing links

02-03-2006, 06:44 PM
The website I am creating is structured like this:

I have three contents boxes on my webpage. On the left side I have a category box (rs2), the middle contains the books(rs1) and the right box contains the subcategories(rs3). Everything works but when I click on the subcategory links, they disappear! although the correct books display. They are all linked to the same page.

To be more specific here is the sql code for rs1, 2 and 3.

FROM book
WHERE cat_non_fiction_id = MMColParam OR sub_id = Sub

FROM cat_non_fiction

FROM subcategory
WHERE cat_non_fiction_id = MMColParam

I tried to add the cat_non_fiction_id parameter to the rs3 link result which worked, BUT of course more books appeared than they should have because the rs1 sql is just obeying the code: WHERE cat_non_fiction_id = MMColParam OR sub_id = Sub

Is there any way I can stop the rs3 (subcategory links) from disappearing once they have been clicked?


02-07-2006, 01:48 PM
but when I click on the subcategory links, they disappear!

this happens because you are clearing vars from your previous submit

e.g ....
you call the page which sets the recordsets 1st time which is ok

when you click a link to the same page you are calling the page again but are not setting the recordsets therefore they are empty

you can solve this 2 ways

1. set your first submit method to a GET then on the links add ....
same_page (page.php?var1=variable1&var2=variable2)
when you click the above link it will return the page but also add the vars to the $_GET method variables

2. leave your first submit as a POST and then wrap your var declarations in an IF statement....
same_page (page.php?var1=variable1&var2=variable2&method=get)

notice that i added an additional get var on the link..method=get

just catch this in your IF statement

$method = $_GET['method'].
IF ($method =='get'){

$var1 = $_GET['var1'];
$var2 = $_GET['var2'];


$var1 = $_POST['var1'];
$var2 = $_POST['var2'];