session problem in pagination - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: session problem in pagination (/showthread.php?tid=18141) Pages:
1
2
|
session problem in pagination - El Forum - 04-27-2009 [eluser]rajyakshmik[/eluser] When i m cliking pagination i m losing session value,How to rectify this prob.. session problem in pagination - El Forum - 04-27-2009 [eluser]Thorpe Obazee[/eluser] You're probably doing something wrong.... Show your code and someone is bound to answer. session problem in pagination - El Forum - 04-27-2009 [eluser]rajyakshmik[/eluser] //view code function dealsearch() { if(document.form1.zip.value=='' && document.form1.keywords.value=='') { document.form1.zip.value=0; document.form1.keywords.value=0; document.form1.action="main/search/N"; } if(document.form1.zip.value!='' && document.form1.keywords.value=='') { document.form1.keywords.value=0; document.form1.action="main/search/S1"; } if(document.form1.zip.value=='' && document.form1.keywords.value!='') { document.form1.zip.value=0; document.form1.action="main/search/S2"; } else { document.forms[0].action="main/search/S"; } //document.form1.action="main/search/S"; } <form method="post" name="form1"> <div id="Layer4"> </div> <div id="Layer5"> <div id="Layer6"> <table width="98%" height="69" border="0" align="center" cellspacing="0"> <tr> <td colspan="7"> <img src="images/searchdeal.jpg" /></td> </tr> <tr> <td width="12%" align="right" class="dealsearch" >ZipCode</td> <td width="14%"> <input type="text" name="zip" width="20" tabindex="7" size="5" maxlength="5" value="<?php if($_SESSION['zip']!='') echo $_SESSION['zip'];?>"/> </td> <!--<<td width="12%" align="right" class="dealsearch">Business Type </td> <td width="22%">select name="businesstype" tabindex="8"><option value="0">--Select Business Type--</option> <?php //foreach ($query2->result() as $row) // { ?> <option value='<?php //echo $row->MerchantType;?>' <?php //if($_SESSION['businesstype']!='') { if($row->MerchantType == $_SESSION['businesstype']) //echo "selected"; }?> ><?php //echo $row->MerchantType;?></option>"; <?php // } ?> </select></td>--> <td width="9%" align="right" class="dealsearch">Keywords</td> <td width="26%"> <input type="text" name="keywords" width="20" size="30" tabindex="9" value="<?php if($_SESSION['keywords']!='') echo $_SESSION['keywords'];?>"/></td> <td width="12%"><input type="image" src="images/searchbtn.jpg" border="0" tabindex="10" > </td> </tr> </table> </div> </div> </form> //Controller code function search($key) { $condi =''; $codetype=''; $data['msg'] =''; if($key == 'S') { if($_POST['zip']!='0') $_SESSION['zip'] = $_POST['zip']; if($_POST['keywords']!='0') $_SESSION['keywords'] = $_POST['keywords']; } else if($key == 'S1') { if($_POST['zip']!='0') $_SESSION['zip'] = $_POST['zip']; } else if($key == 'S2') { // echo '===>'.$_POST['keywords']; if($_POST['keywords']!='0') $_SESSION['keywords'] = $_POST['keywords']; } else if($key == 'N') { $_POST['zip']=''; //$_POST['businesstype']=''; $_POST['keywords']=''; $_SESSION['keywords']=''; //$_SESSION['businesstype']=''; $_SESSION['zip']=''; } else { //echo 'sfsdf'; $_POST['zip']=''; //$_POST['businesstype']=''; $_POST['keywords']=''; $_SESSION['keywords']=''; //$_SESSION['businesstype']=''; $_SESSION['zip']=''; } //echo '===>'.$_SESSION['keywords']; if($_SESSION['zip']!='') { $condi.= " and merchants.zip ='$_SESSION[zip]'"; } /* if($_SESSION['businesstype']!=0) { $condi.= " and merchants.MerchantType ='$_SESSION[businesstype]'"; }*/ session problem in pagination - El Forum - 04-27-2009 [eluser]TheFuzzy0ne[/eluser] Please wrap your code in [code] [/code] tags. session problem in pagination - El Forum - 04-27-2009 [eluser]rajyakshmik[/eluser] //view code Code: function dealsearch() session problem in pagination - El Forum - 04-27-2009 [eluser]narkaT[/eluser] does your app use cookies to store the session id? session problem in pagination - El Forum - 04-27-2009 [eluser]rajyakshmik[/eluser] Yes .I m using Code: $config['sess_cookie_name'] = 'ci_session'; session problem in pagination - El Forum - 04-27-2009 [eluser]TheFuzzy0ne[/eluser] You should be using $this->input->post() to access the post array, and $this->session->set_userdata() for setting session data. session problem in pagination - El Forum - 04-27-2009 [eluser]rajyakshmik[/eluser] same problem.I m using like this Code: else if($key == 'S1') Code: if($this->session->userdata('zip')!='') session problem in pagination - El Forum - 04-27-2009 [eluser]TheFuzzy0ne[/eluser] Please attach the file containing all of your controller code. |