ayuscomeyh 0 Newbie Poster

how to pass the value 'id_category' from this page
list.php

<title>home</title>
<!--for auto refresh--> 
<META HTTP-EQUIV=Refresh CONTENT="300; URL=http://localhost/recipe2/home.php">
<body>
<div align="left"><img src="Cookie Banner edited.jpg" width="1100" height="200" /></div>
<h2>My Account </h2>

<p>chef today : <?php echo $_SESSION['myusername']; ?> | <a href="logout.php">Logout</a> </p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<?php
include 'recipe2db.php';

$sql="SELECT id_category FROM category where id_category='$id_category'";

$result=mysql_query($sql);

$rows=mysql_fetch_array ($result);

?>

<form id="form1" name="form1" method="post" action="home.php">
  <table width="200" border="0" align="center">
    <tr>
      <td>
        <div align="center">
       <input align="center" type="submit" name="Submit" value="biskut" />

        <input align="center" type="hidden" name="id" value="<? echo $rows['1']; ?>" />
        </div>
           </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
        <tr>
      <td><div align="center">
        <input align="center" type="submit" name="Submit" value="kek" />

		<input align="center" type="hidden" name="id" value="<? echo $rows['2']; ?>" />
      </div></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><div align="center">
       <input align="center" type="submit" name="Submit" value="minuman" />

		<input align="center" type="hidden" name="id" value="<? echo $rows['3']; ?>" />
      </div></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><div align="center">
        <input align="center" type="submit" name="Submit" value="kuih raya" />

        <input align="center" type="hidden" name="id" value="<? echo $rows['4']; ?>" />

      </div></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
     <tr>
      <td><div align="center">
       <input align="center" type="submit" name="Submit" value="puding" />

		<input align="center" type="hidden" name="id" value="<? echo $rows['5']; ?>" />
      </div></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><div align="center">
       <input align="center" type="submit" name="Submit" value="western" />

		<input align="center" type="hidden" name="id" value="<? echo $rows['6']; ?>" />
      </div></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><div align="center">
      <input align="center" type="submit" name="Submit" value="all" />

		<input align="center" type="hidden" name="id" value="<? echo $rows['id_category']; ?>" />
      </div></td>
    </tr>
  </table>
  </form>
  
</head>

to this home.php

</head>

<body>
<div align="left"><img src="Cookie Banner edited.jpg" width="1100" height="200" /></div>
<h2>My Account </h2>

chef today : <?php echo $_SESSION['myusername']; ?> | <a href="logout.php">Logout</a> 

<p>&nbsp;</p>
<p><a href="list.php">BACK</a></p>
<table width="1091" border="1" cellspacing="0" cellpadding="3">
<thead>
<th>no</th>
<th>name</th>
<th>ingredient</th>
<th>how to cook</th>
<th>category</th>
<th>action</th>
</thead>

<?php
include 'recipe2db.php';

$id_category=$_REQUEST['id_category'];

//$sql= "select * from recipe where id_categori= '$id_category'";  
// Retrieve data from database( use inner join tok gabung 2table bg attribute yg same//kalo leftjoin xkisah kosg or xd value)
$sql="SELECT r.*, c.category_name as nama_kategori FROM `recipe` r inner join category c on r.id_category=c.id_category order by r.id_category";

$result=mysql_query($sql);

$count=1;
// Start looping rows in mysql database.
while($rows=mysql_fetch_array($result)){
?>

<tr>
<td width ="15%"><div align="center"><? echo $count++ ?> </div> </td>
<td width="15%"><div align="center"><? echo $rows['name']; ?></div> </td>
<td width="25%" ><div align="center"><? echo $rows['bahan']; ?></div> </td>
<td width="31%" ><div align="center"><? echo $rows['cara'];?></div> </td>
<td width="13%"><div align="center"><? echo $rows['nama_kategori']; ?></div> </td>
<td width="10%"><div align="center"><a href="delete.php?id=<? echo $rows['id']; ?>">delete</a>/<a href="update.php?id=<? echo $rows['id']; ?>">update</a></div></td>
</tr>

<?
// close while loop
}

// close connection
mysql_close();
?>
</table>


<form id="form1" name="form1" method="post" action="add.php">
  <label>
  <input type="submit" name="btnadd" id="btnadd" value="ADD new" />
   </label>
</form>
</body>


</html>

correct my code if i'm wrong..