获取php变量中的输入标记值,无需表单操作

I have a navigation which is dynamically set through database. I have a category and subcategory table. I have arranged my navigation bar with category table and using its foreign key when i hover over category it shows it's subcategories.It is working correctly! I have given a input value with both category and subcategory which is hidden and it consist of cat_id and s_cat_id.Both are primary keys of category table and subcategory table. Now i am trying to access id's when i click on any of the hover list. I am stuck here. Any suggestions will be highly appreciated!

Code

<ul id="nav">
<?php
$res=mysqli_query($con,"SELECT * FROM category");
while($row=mysqli_fetch_array($res))
{
 ?>
<li>
      <li>  <a href="<?php echo "index.php?page=".$row1['s_cat_name']."&s_cat_id=".$row1['s_cat_id']; ?>"><?php echo $row1['s_cat_name'];?></a></li>    
    <ul>
        <?php
        $result=mysqli_query($con,"SELECT * FROM subcategory WHERE cat_id=".$row['cat_id']);
       while($row1=mysqli_fetch_array($result))
        {
         ?>
       <li>  <a href="<?php echo "index.php?mode=2&page=".$row1['s_cat_name']; ?>"><?php echo $row1['s_cat_name'] ?><input type="" name="s_cat_id" value="<?php echo $row1['s_cat_id'] ?>"></a></li>
        <?php
        }
        ?>
    </ul>
</li>
    <?php
    }
    ?>

Don't use input field for that if you want on click then add argument in link like

<li>  <a href="<?php echo "index.php?page=".$row1['s_cat_name']."&s_cat_id=".$row1['s_cat_id']; ?>"></a></li>

You have different errors int he part were you tried:

        <?php
        $page= $_GET['page'];
      //This is what i have tried
        $catid=$_POST['cat_id'];
        echo $catid;
        $scatid=$_POST['s_cat_id'];
        echo $scatid;
        ?>
  1. you're mixing post and get.
  2. you can only use post if you have a form that will post the info for you (or something that can make a post request)

Try to change all the POST to GET