简体   繁体   中英

form action add page search

I have a problem I hope you understand I write English badly: I created a search field that contains these two files index.php

 <?php include('db.php'); $keySesso = $_GET['sesso']; $keyEta = $_GET['eta']; $keyRegione = $_GET['regione']; $keyFoto = $_GET['foto']; //sesso if(isset($keySesso)){ if ($keySesso == 2) { $FemminaE="selected"; }else if ($keySesso == 1){ $MaschioE="selected"; }else if ($keySesso == 26){ $Gay="selected"; }else if ($keySesso == 27){ $Lesbica="selected"; }else if ($keySesso == 29){ $FemminaB="selected"; }else if ($keySesso == 28){ $MaschioB="selected"; }else{ $sessoN=""; } } //for total count data $countSql = "SELECT COUNT(last_activity) FROM _core_members INNER JOIN _core_pfields_content ON _core_members.member_id = _core_pfields_content.member_id $whereSQL $keyRegione $CondizioneEta $CondizioneFoto "; $tot_result = mysqli_query($conn, $countSql); $row = mysqli_fetch_row($tot_result); $total_records = $row[0]; $total_pages = ceil($total_records / $limit); //for first time load data if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; }; $start_from = ($page-1) * $limit; $sql = "SELECT * FROM _core_members INNER JOIN _core_pfields_content ON _core_members.member_id = _core_pfields_content.member_id $whereSQL $keyRegione $CondizioneEta $CondizioneFoto ORDER BY last_activity DESC LIMIT $start_from, $limit"; $rs_result = mysqli_query($conn, $sql); ?> <!DOCTYPE html> <head> </head> <body > <div class="BloccoBaseBO"> <div class="container" id="BOcontent"> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="tab1"> <form method='GET' id='FormChattaCon' class='FormBase' action=''> <select id="SelectedSesso" name="sesso"> <option value="" <?php echo $sessoN; ?>>Tutti i generi</option> <option value="2" <?php echo $FemminaE; ?>>femmine (Etero)</option> <option value="1" <?php echo $MaschioE; ?>>maschi (Etero)</option> <option value="26" <?php echo $Gay; ?>>Gay</option> <option value="27" <?php echo $Lesbica; ?>>Lesbica</option> <option value="29" <?php echo $FemminaB; ?>>Femmina (Bisex)</option> <option value="28" <?php echo $MaschioB; ?>>Maschio (Bisex)</option> </select> <div class='ConFoto'>Con Foto: <input id="checkBox" name="foto" type="checkbox" onclick="javascript: submitform()" <?php echo $check;?>/> </div> </form> <table class="table table-bordered table-striped"> <tbody id="target-content"> <?php while ($row = mysqli_fetch_assoc($rs_result)) { echo "<div class='bloccoUserOnlineBO'></div><li class='NomeBloccoB'>$MemberName</li>"; }; ?> </tbody> </table> <nav><ul class="pagination"> <?php if(!empty($total_pages)):for($i=0; $i<=$total_pages; $i++): if($i == 0):?> <li class='active' id="<?php echo $i;?>"><a href='pagination.php?page=<?php echo $i;?>'><?php echo $i;?></a></li> <?php else:?> <li id="<?php echo $i;?>"><a href='pagination.php?page=<?php echo $i;?>'><?php echo $i;?></a></li> <?php endif;?> <?php endfor;endif;?> </ul> </nav> </div> </div> </div> <script type="text/javascript"> $(document).ready(function(){ $('.pagination').pagination({ items: <?php echo $total_records;?>, itemsOnPage: <?php echo $limit;?>, cssStyle: 'light-theme', currentPage : 0, onPageClick : function(pageNumber) { jQuery("#target-content").html('loading...'); jQuery("#target-content").load("pagination.php?page=" + pageNumber); } }); }); </script> <!-- tab --> <script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="js/jquery.scrolling-tabs.js"></script> <script> $('.nav-tabs').scrollingTabs(); </script> <!-- FlexSlider --> <script src="http://www..it/info-user-global/js/jquery.flexslider-min.js"></script> <script src="http://www..it/info-user-global/js/main.js"></script> 
the second where it is recalled from the pages pagination.php

 <?php include('db.php'); if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; }; $start_from = ($page-1) * $limit; $sql = "SELECT * FROM ILFREE_core_members INNER JOIN ILFREE_core_pfields_content ON ILFREE_core_members.member_id = ILFREE_core_pfields_content.member_id $whereSQL $keyRegione $CondizioneEta $CondizioneFoto ORDER BY last_activity DESC LIMIT $start_from, $limit"; $rs_result = mysqli_query($conn, $sql); ?> <?php while ($row = mysqli_fetch_assoc($rs_result)) { echo "<div class='bloccoUserOnlineBO'></div><li class='NomeBloccoB'>$MemberName</li>"; }; ?> 

The problem is this When I compile the form, the result appears only on the index.php page When I push the buttons on the bottom pages linked to the pagination.php page, I reset the form enter image description here

I can not fix it because the form data will stop at the index page but when I call the pagination.php file through this:

 <script type="text/javascript"> $(document).ready(function(){ $('.pagination').pagination({ items: <?php echo $total_records;?>, itemsOnPage: <?php echo $limit;?>, cssStyle: 'light-theme', currentPage : 0, onPageClick : function(pageNumber) { jQuery("#target-content").html('loading...'); jQuery("#target-content").load("pagination.php?page=" + pageNumber); } }); }); </script> 

I reset the form Please help me I hope I was clear I also leave you an email, I am willing to pay for help IlfreeIF@gmail.com

This is exactly what AJAX is for (AJAX can do the same .load() function can, but with more configurability):

  1. http://www.seguetech.com/ajax-technology/
  2. jQuery Ajax POST example with PHP

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM