yanivkalfa Posted July 23, 2008 Share Posted July 23, 2008 Ok its like this . i have search on my site with 2 mods . mod 1 .. normal search with no advanced options . mod 2 opened search == with advanceds search options . now i basicaly use div . that i change its attributs acording the $advs variable if set to 1 or 0 - on set 1 the div get bigger and the pic changes if set to 0 div get smaller and pic changes to normal close search pic . ( on the button of page i have this if -- if $advs set to 1 means that search is allready on advs mod and sould put a linke with bla/?advs=0 else it will put same linke with 1 basicaly that will make the search to be advanced or normal search. i also set a hidden variable on that search .. form that will contain my advs variable so if i clicked on advanced and then click on submit button it will keep the settings of the search(for advanced search or not ) problem is that i cant manage to keep the search results after clicking on submit when i click on advanced options i will explain. i type in a word then click submit. search results coming but then when i click on the link to open advanced .. while sending the search details in that link as well . makes a problem that i cant find how to fix it .. i also asking if there any other way of doing this advanced or not advanced options .. on the same page without opening a new page other then PHP. here is the code: <form action="search.php" method="POST" name="gobutt"> <div id="Sem"></div> <input name="search" type="text" value="<?php echo $search; ?>" class="seach"/> <div id="checkv"> <input type="checkbox" checked="rel" name="rel" value="rel" class="styled" /> </div> <?php if($advns == 1){ ?> <div id="checkMov"> <input type="checkbox" name="mov" checked="mov" value="mov" class="styled" /> </div> <div id="checkgam"> <input type="checkbox" name="gam" checked="gam" value="gam" class="styled" /> </div> <div id="checkapp"> <input type="checkbox" name="app" checked="app" value="app" class="styled" /> </div> <div id="checkMus"> <input type="checkbox" name="mus" checked="mus" value="mus" class="styled" /> </div> <div id="checkebok"> <input type="checkbox" name="ebook" checked="ebook" value="ebook" class="styled" /> </div> <div id="checkexp"> <input type="checkbox" name="exp" checked="exp" value="exp" class="styled" /> </div> <div id="backgeounsd"> <input name="advns" type="text" class="seachc" value="<?php echo $advns; ?>" /> </div> <?php } else { $mov="mov"; $gam="gam"; $app="app"; $mus="mus"; $ebook="ebook"; $exp="exp"; ?> <div id="backgeounsd"> <input name="advns" type="text" class="seachc" value="<?php echo advns; ?>" /> </div> <?php } ?> <input type="submit" name="submit" value=" " class="gob"/> </form> <div id="divtable"> <table width="450" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td colspan="3"><img src="TopPart.png" width="579" height="164" /></td> </tr> <?php if($search == ""){ echo ' <tr> <td width="40"><img src="LeftTablepart.png"/></td> <td width="501"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="table"> <tr> <td width="100%" height="15">Please specify a search query!</td> </tr> </table></td> <td width="26"><div align="right"><img src="RightTablepart.png" width="26" height="15" /></div></td> </tr> '; } else{ if($submit != ""){ //checking is search is set first BIG if ------------------------------------------- if($search != ""){ //starting search qery if search variable exists $search = $search; $limit = 40; $searchquar = "SELECT * FROM downloads WHERE "; $cat = ""; if(($mov == "") or ($gam == "") or ($app == "") or ($mus == "") or ($ebook == "") or ($exp == "")){ if($gam == ""){ $cat .= "Category='Games' "; } if($app == ""){ if($cat != ""){$cat .= "OR Category='Applications' ";} else{$cat = "Category='Applications' ";} } if($mov == ""){ if($cat != ""){$cat .= "OR Category='Movies' ";} else{$cat = "Category='Movies' ";} } if($ebook == ""){ if($cat != ""){$cat .= "OR Category='E-Books' ";} else{$cat = "Category='E-Books' ";} } if($mus == ""){ if($cat != ""){$cat .= "OR Category='Music' ";} else{$cat = "Category='Music' ";} } if($exp == ""){ if($cat != ""){$cat .= "AND Screens !='' ";} else{$cat = "Screens !='' ";} } // if($_POST['rel'] != "rel"){ // if($cat != ""){$cat .= "OR Category='Music' ";} //else{$cat = "Category='Music' ";} //} $searchquar .= $cat."and "; // echo '<div id="massgbox">hehehehs</div>'; check field } $searchquar .= "Verified !='Reported!' AND Verified !='Broken!' AND Title LIKE '%$search%' ORDER BY Title"; $result_count = mysql_query($searchquar) or die("Error: " . mysql_error()); while($arr = mysql_fetch_array($result_count)){ $totalrows++; } echo '<div id="massgbox"><p>'.$searchquar.'<p>'; if(!isset($page)){ $page = 1; } $limitvalue = $page * $limit - ($limit); $resualtquar ="SELECT * FROM downloads WHERE "; if(!empty($cat)){$resualtquar .= $cat."and ";} $resualtquar .="Verified !='Reported!' AND Verified !='Broken!' AND Title LIKE '%$search%' ORDER BY Title LIMIT $limitvalue, $limit "; $query = $resualtquar; $result = mysql_query($query) or die("Error: " . mysql_error()); echo '<p>'.$resualtquar.'<p></div>'; if(mysql_num_rows($result) == 0){ echo ' <tr> <td width="40"><img src="LeftTablepart.png"/></td> <td width="501"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="table"> <tr> <td width="100%" height="15">Your search found no results!</td> </tr> </table></td> <td width="26"><div align="right"><img src="RightTablepart.png" width="26" height="15" /></div></td> </tr> '; } else{ while($row = mysql_fetch_array($result)){ ?> <td width="40"><img src="LeftTablepart.png"/></td> <td width="501"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="table"> <a href=" <?php $_SERVER['PHP_SELF']; ?>/realysite/search.php?DlID=<?php echo $row["ID"]; ?> "> <tr> <td width="29%" height="15"> <?php $SeTitle =$row["Title"]; if(strlen($SeTitle) > 1 ){ if(strlen($SeTitle) > 23 ){ $SeTitle = str_split($SeTitle, 20); $SeTitle = $SeTitle[0]."..."; } } echo $SeTitle; ?> </td> <td width="12%"><div align="center"> <?php $SeTitle =$row["Source"]; if(strlen($SeTitle) > 1 ){ if(strlen($SeTitle) > 8 ){ $SeTitle = str_split($SeTitle, 5); $SeTitle = $SeTitle[0]."..."; } } echo $SeTitle; ?> </td></div></td> <td width="15%"><div align="center"> <?php $SeTitle =$row["ReleaseGroup"]; if(strlen($SeTitle) > 1 ){ if(strlen($SeTitle) > 9 ){ $SeTitle = str_split($SeTitle, 6); $SeTitle = $SeTitle[0]."..."; } } echo $SeTitle; ?> </div></td> <td width="11%"><div align="center"> <?php $SeTitle =$row["LinksType"]; if(strlen($SeTitle) > 1 ){ if(strlen($SeTitle) > 9 ){ $SeTitle = str_split($SeTitle, 6); $SeTitle = $SeTitle[0]."..."; } } echo $SeTitle; ?> </div></td> <td width="7%"><div align="center"> <?php $SeTitle =$row["Rating"]; if(strlen($SeTitle) > 1 ){ if(strlen($SeTitle) > 9 ){ $SeTitle = str_split($SeTitle, 6); $SeTitle = $SeTitle[0]."..."; } } echo $SeTitle; ?> </div></td> <td width="8%"><div align="center"> <?php $SeTitle =$row["TotalFilesAndSize"]; if(strlen($SeTitle) > 1 ){ if(strlen($SeTitle) > 8 ){ $SeTitle = str_split($SeTitle, 5); $SeTitle = $SeTitle[0]."..."; } } echo $SeTitle; ?> </div></td> <td width="10%"><div align="center"> <?php $SeTitle =$row["Downloads"]; if(strlen($SeTitle) > 1 ){ if(strlen($SeTitle) > 9 ){ $SeTitle = str_split($SeTitle, 6); $SeTitle = $SeTitle[0]."..."; } } echo $SeTitle; ?> </div></td> <td width="8%"><div align="center"> <?php $SeTitle =$row["MAdvFPS"]; if(strlen($SeTitle) > 1 ){ if(strlen($SeTitle) > 9 ){ $SeTitle = str_split($SeTitle, 6); $SeTitle = $SeTitle[0]."..."; } } echo $SeTitle; ?> </div></td> </tr> </table></td> <td width="26"><div align="right"><img src="RightTablepart.png" width="26" height="15" /></div></td> </tr> <?php } } } } } ?> <tr> <td width="40"><img src="LeftTablepart.png"/></td> <td width="501"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="table"> <tr> <td width="29%" height="15"> </td> <td width="12%"> </td> <td width="15%"> </td> <td width="11%"> </td> <td width="7%"> </td> <td width="8%"> </td> <td width="10%"> </td> <td width="8%"> </td> </tr> </table></td> <td width="26"><div align="right"><img src="RightTablepart.png" width="26" height="15" /></div></td> </tr> <tr> <td colspan="3"><img src="Buttompart.png" width="579" height="320" /></td> </tr> </table> </div> <?php if($search !="" and if($advns != 1){ $Pagelocation= $_SERVER['PHP_SELF']; echo' <div id="pinc"> <a href="'.$Pagelocation.'?advns=1&search='.$search.'&rel='.$rel.'&mov='.$mov.'&gam='.$gam.'&app='.$app.'&mus='.$mus.'&exp='.$exp.'&ebook='.$ebook.'&submit='.$submit.'"></a> </div>'; } else { echo ' <div id="pinc"> <a href="'.$Pagelocation.'?advns=0&search='.$search.'&rel='.$rel.'&mov='.$mov.'&gam='.$gam.'&app='.$app.'&mus='.$mus.'&exp='.$exp.'&ebook='.$ebook.'&submit='.$submit.'"></a> </div>'; } ?> sorry for the big massage thanks in advanced. Quote Link to comment https://forums.phpfreaks.com/topic/116157-mind-brakeing-problem-allready-been-on-it-for-like-2-days-please-help/ Share on other sites More sharing options...
ignace Posted July 23, 2008 Share Posted July 23, 2008 i can have a big massage anytime <form action="search.php?advns=<?php echo $advns; ?>" method="post" enctype="application .. this may be a bit strange for you, but you are able to receive get on a HTTP POST request, the other way around however does not work! else { $mov="mov"; $gam="gam"; $app="app"; $mus="mus"; $ebook="ebook"; $exp="exp"; ?> <div id="backgeounsd"> <input name="advns" type="text" class="seachc" value="<?php echo $advns; /* you forgot the $ */ ?>" /> <td width="40"><img src="LeftTablepart.png"/></td> <td width="501"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="table"> <a href=" <?php echo $_SERVER['PHP_SELF']; /* you forgot to echo it */ ?>/realysite/search.php?DlID=<?php echo $row["ID"]; ?> "> <?php if($search !="" and $advns != 1){ /* you wrote and if ($advns != 1) */ Quote Link to comment https://forums.phpfreaks.com/topic/116157-mind-brakeing-problem-allready-been-on-it-for-like-2-days-please-help/#findComment-597337 Share on other sites More sharing options...
wrathican Posted July 23, 2008 Share Posted July 23, 2008 well that wasnt helpful at all. this is a HELP forum afterall.. any way. i dunno if it will help but i noticed this: <div id="backgeounsd"> <input name="advns" type="text" class="seachc" value="<?php echo advns; ?>" /> </div> <?php you forgot to add the $ before advns if you are wanting to display an 'advanced' search search area you might want to look at using javascript to display a div containing the extra form fields. Quote Link to comment https://forums.phpfreaks.com/topic/116157-mind-brakeing-problem-allready-been-on-it-for-like-2-days-please-help/#findComment-597338 Share on other sites More sharing options...
ignace Posted July 23, 2008 Share Posted July 23, 2008 well that wasnt helpful at all. this is a HELP forum afterall.. lol ??? did you even tried it? i mean your code is full of errors!! Quote Link to comment https://forums.phpfreaks.com/topic/116157-mind-brakeing-problem-allready-been-on-it-for-like-2-days-please-help/#findComment-597344 Share on other sites More sharing options...
wrathican Posted July 23, 2008 Share Posted July 23, 2008 you edited your post after i said that. there was no 'help' before you edited it. Quote Link to comment https://forums.phpfreaks.com/topic/116157-mind-brakeing-problem-allready-been-on-it-for-like-2-days-please-help/#findComment-597347 Share on other sites More sharing options...
yanivkalfa Posted July 23, 2008 Author Share Posted July 23, 2008 mates no need fighting anyways . let me answer something this was actualy a nice idea will save me something.. that you guys thought i was forgetting .. <form action="search.php?advns=<?php echo $advns; ?>" method="post" enctype="application .. this may be a bit strange for you, but you are able to receive get on a HTTP POST request, the other way around however does notwork! ---- allthough i use registerglobals which comblitly cancle the whole post / get they php treat both $_post['bla'] and $_get['bla'] the same . it will use it as $bla. <div id="backgeounsd"> <input name="advns" type="text" class="seachc" value="<?php echo $advns; /* you forgot the $ */ ?>" /> [/code thanks i idnt noticed till now . [code] <td width="501"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="table"> <a href=" <?php echo $_SERVER['PHP_SELF']; /* you forgot to echo it */ ?>/realysite/search.php?DlID=<?php echo $row["ID"]; ?> "> this 1 i dont need at all i was just as a debug that i used before and forgot deleteing . but still mates after this the problem still isnt fixed . couse this wasnt the problem . the problem is way more complicated then this try to look at the script's flow and see it not the typeing mistakes that matters its something else i cant figure out. [/code] Quote Link to comment https://forums.phpfreaks.com/topic/116157-mind-brakeing-problem-allready-been-on-it-for-like-2-days-please-help/#findComment-597359 Share on other sites More sharing options...
yanivkalfa Posted July 24, 2008 Author Share Posted July 24, 2008 anyone mates ? Quote Link to comment https://forums.phpfreaks.com/topic/116157-mind-brakeing-problem-allready-been-on-it-for-like-2-days-please-help/#findComment-598237 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.