budimir Posted April 6, 2013 Share Posted April 6, 2013 Guys, How could I keep values when isset() is clicked and after that a link is clicked which does something. I have paging inside if (isset(submit)) and when clicked next on paging everything goes back to previous state it doesn't keep values for filtering. Below is code, I'm using. Please, help... Form <form method="GET" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="hidden" name="id" value="<?php echo "$id_kalkulacije"; ?>"> Upišite podgrupu proizvoda: <input type="text" name="podgrupa_proz"> <input type="submit" name="submit1" value="Traži"> </form> Php code else if (isset($_GET["submit1"])) { //pretraživanje po kategoriji $id_kalkulacije = $_GET["id"]; $podgrupa_proz = $_GET["podgrupa_proz"]; $_SESSION["podgrupa_proz"] = $podgrupa_proz; //Početak paginga if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } // if $upit11 = mysql_query("SELECT id FROM kalkulacija_stavke WHERE id_kalkulacija = '$id_kalkulacije' AND podgrupa_proizvoda LIKE '%".$_SESSION["podgrupa_proz"]."%'") or die (mysql_error()); $brojcanik = mysql_num_rows($upit11); $rows_per_page = 100; $lastpage = ceil($brojcanik/$rows_per_page); $pageno = (int)$pageno; if ($pageno > $lastpage) { $pageno = $lastpage; } // if if ($pageno < 1) { $pageno = 1; } // if $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; SOME QUERY WITH RESULT DISPLAY HERE...... if ($pageno == 1) { echo " <font color='#990000'>Početak</font> || Natrag "; } else { echo " <a href='{$_SERVER['PHP_SELF']}?pageno=1&id=$id_kalkulacije&podgrupa_proz=$podgrupa_proz'>Prva</a> | "; $prevpage = $pageno-1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage&id=$id_kalkulacije&podgrupa_proz=$podgrupa_proz'>Natrag</a> "; } // if echo " ( <font color='grey'>Stranica - <b>$pageno</b> od <b>$lastpage</b></font> ) "; if ($pageno == $lastpage) { echo " Naprijed || <font color='#990000'>Kraj</font> "; } else { $nextpage = $pageno+1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage&id=$id_kalkulacije&podgrupa_proz=$podgrupa_proz'>Naprijed</a> | "; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$lastpage&id=$id_kalkulacije&podgrupa_proz=$podgrupa_proz'>Posljednja</a> "; } // if echo " <br />Rezultata: ".$brojcanik." </p>"; Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 6, 2013 Share Posted April 6, 2013 Store the data in the Session. Quote Link to comment Share on other sites More sharing options...
Solution budimir Posted April 6, 2013 Author Solution Share Posted April 6, 2013 I did store it in Session, but it doesn't work for some reason which I can't figure out. I do a session_start() in one of the include files I'm using, if you thought I didn't start the session. Is it a problem with if (isset(submit)) that's not set when I click a link for next page on paging part??? If that is the problem how can I go around it? Quote Link to comment 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.