php - retrieve information and select information popup in another page -


this code of search.php: (this part search keyword , display retrievecustomerinfo.php)

<?php  $strkeyword = null; ?>  <body> <div align="center"> <form name="frmsearch" method="post" action="retrievecustomerinfo.php">     <table >         <tr>             <th>keyword                 <input name="txtkeyword" type="text" id="txtkeyword" value="<?php echo $strkeyword; ?>">                 <input type="submit" value="search">             </th>          </tr>     </table>     <br> </form> </div> </body> 

this code of retrievecustomerinfo.php: (this page show result user need information.)

<?php ini_set('display_errors', 1); error_reporting(~0);  $strkeyword = null;  if (isset($_post["txtkeyword"])) {     $strkeyword = $_post["txtkeyword"]; } $sql = "select * customer_info cust_ic '%" . $strkeyword . "%' or cust_hp_contact1 '%" . $strkeyword ."%' or cust_name '%" . $strkeyword . "%' limit {$start} , {$perpage}";  $query = mysqli_query($conn, $sql); ?> <form name="retrieve" action="topuppage.php" method="post"> <table class="table table-hover" >     <thead>         <tr>             <th>number</th>             <th>name</th>             <th>state</th>             <th>contact number</th>             <th>action</th>         </tr>     </thead>      <?php     $no = 1;     while ($result = mysqli_fetch_array($query, mysqli_assoc)) {         ?>         <tr>             <td><?php echo $no ?></td>             <td><?php echo $result['cust_name'] ?></td>             <td><?php echo $result['cust_state'] ?></td>             <td><?php echo $result['cust_hp_contact1'] ?>                 <?php echo $result['cust_hp_contact2'] ?></td>              <td>                 <button type="submit" name="cust_name" value="<?php echo $result['cust_name'] ;?>"                            name="cust_hp_contact1" value="<?php echo $result['cust_hp_contact1'] ;?>" class="btn btn-link">select</button>             </td>         </tr>         <?php         $no++;     }     ?> </table> <?php mysqli_close($conn); ?> 

this code of topuppage: (this page show value user selected in retrievecustomerinfo.php)

<form name="getdata" method="get"> <div>      <h5>tag sale order following customer</h5>     <div class="col-xs-3">         <label for="cname">contact name</label>         <input type="text" class="form-control input-sm" id="cname"                 value="                    <?php                     if(isset($_post['cust_name']))                         {                         echo $_post['cust_name'];                          }                         ?> ">            <label for="cno">contact number</label>         <input type="text" class="form-control input-sm" id="cno"                 value="                    <?php                     if(isset($_post['cust_hp_contact1']))                         {                         echo $_post['cust_hp_contact1'];                          }                         ?> ">         <p></p>         <button type="reset" class="btn btn-default">clear</button>     </div>  </div> </form> 

how value retrievecustomerinfo.php , post topuppage.php 's textbox should contact name , contact number?

in retrievecustomerinfo.php add value , name attribute submit button:

while ($result = mysqli_fetch_array($query, mysqli_assoc)) {     ?>     <tr>         <td><?php echo $no ?></td>         <td><?php echo $result['cust_name'] ?></td>         <td><?php echo $result['cust_state'] ?></td>         <td><?php echo $result['cust_hp_contact1'] ?>             <?php echo $result['cust_hp_contact2'] ?></td>          <td>             <button type="submit" name="cust_name" value="<?php echo $result['cust_name'] ?>" class="btn btn-link">select</button>         </td>     </tr>     <?php     $no++; } 

and $_post value in topuppage.php:

<input type="text" class="form-control input-sm" id="cname" value="<?php echo $_post['cust_name']; ?>"> 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -