Jump to content

how to keep $_post value


m118

Recommended Posts

I use a form to sent date and  use php to display it . However , the code only can working on one page. I can not turn the page. I do not why . Please tell me reason . Thank you very much.

 

<select name="kind">

  <option >kind</option>

<option value="Copier Toner">Copier Toner</option>

        <option value="Laser Toner">Laser Toner</option>

      <option value="MICR Toner">MICR Toner</option>

      <option value="Inkjet">Inkjet</option>

 

php code

 

if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; };

$start_from = ($page-1) * 18;

 

 

 

$select="select * from $chun where  brand = '$_POST[brand]' or  sort ='$_POST[kind]' or type='$_POST[type]'  LIMIT $start_from, 18";

 

$result2=mysql_query($select, $connection) or die (mysql_error());

 

<?php

$sql = "select count(*) from $chun  where  brand = '$_POST[brand]' or sort='$_POST[kind]' or type='$_POST[type]' ";

 

 

$rs_result = mysql_query($sql,$connection);

$row = mysql_fetch_row($rs_result);

$total_records = $row[0];

$total_pages = ceil($total_records / 18);

 

for ($i=1; $i<=$total_pages; $i++) {

 

 

 

?>

 

 

      <div class="trunpage"><a href='table2.php?page=<?php echo  "$i" ; ?>&id=<?php echo "$_POST[brand]";?>&cd=<?php echo "$_POST[kind]";?>&td=<?php echo "$_POST[type]";?>'  ><?php echo  "$i" ; ?></a>

 

    </div>

   

The first page is working fine. The second page I get error message.

 

Undefined index: brand in C:\wamp\www\php1000\table2.php on line 234

 

 

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/222336-how-to-keep-_post-value/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.