The php code below echoes the image by using the variables $cat & $var, but when I fill the form & press submit, it shows following error redirecting to the same page instead of going to insert.php. The error is :
Notice: Undefined index: number in C:\xampp\htdocs\k\show_results_4.php on line 161
Notice: Undefined index: category in C:\xampp\htdocs\k\show_results_4.php on line 162
Notice: Undefined index: in C:\xampp\htdocs\k\show_results_4.php on line 164
**
    <?php  
                       $var=$_GET['number'];                 //line 161
                        $cat=$_GET['category'];              // line 162
                        $unipath= array('breads','fruits','milk','vegetables');
                        echo $unipath[$cat];                  //line 164
                      echo '<img alt="140x140" src="/k/images/'.$unipath[$cat].'/'.$var.'.jpg" class="img-rounded"/>';
        if(isset($_SESSION['stats']))
            $mode=$_SESSION['stats'];
            if($mode=='vendor')
            {
                echo "<form method='POST' action='insert.php'>
                    Enter price per item/kg:<input type='text' name='pr'>
                    <input type='hidden' name='vegid' value='".$var."'>
                    <input type='hidden' name='vegcat' value='".$cat."'><br/>
                <br/><button type='submit' class='btn btn-primary'> SUBMIT </button>
                </form>";
                        ?>
For reference the insert.php is :
<?php
include 'conf.inc.php';
session_start();
if(!isset($_SESSION['usr']))
header('Location:login.php?t=1');
$id=$_SESSION['id'];
$vegid=$_POST['vegid'];
$vegcat=$_POST['vegcat'];
if(isset($_POST['pr']))
    {
        $price=$_POST['pr']; 
        if(!empty($price))
        {
            $dur=date('d m Y',time());
                        $query="insert into daily values('".$dur."','".$vegid."','".$vegcat."','".$id."','".$price."')";
                        if($query_run=mysql_query($query))
                        {
                                header('Location:Homepage_2.php?suc=1');
                        }
                        else
                        {
                                header('Location:Homepage_2.php?suc=2');
                        }
                }
            else
            {
        header('Location:Homepage_2.php?suc=3');
        }
        echo mysql_error();
}
?>
 
     
    