<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    Product: <select name="s_product">
                <option value="">Plz select product</option>
                <option value="1">TV</option>
                <option value="2">Fan</option>
                <option value="3">Light</option>
    $sql = "SELECT * FROM `data` join product on data.p_id=product.p_id WHERE data.p_id=$product";
<table width="100%" height="25%" >
        <td><h3>Diller Name</h3></td>
        <td><h3>phone Number</h3></td>
        <td><h3>Invoice Number</h3></td>
        <td><h3>Product Name</h3></td>

        echo "<tr><td>".$query2['name']."</td>";
        echo "<td>".$query2['phone_num']."</td>";
        echo "<td>".$query2['date']."</td>";
        echo "<td>".$query2['invoice']."</td>";
        echo "<td>".$query2['p_name']."</td>";
        echo "<td>".$query2['rate']."</td></tr>";

Add a javascript event listener, when the form changes submit the query through an AJAX request. To make it work correctly separate the query script so that it returns only the data you want to display in the page.

var product = document.getElementById('s_product');
product.addEventListener('change', triggerFunction, false);

change should be what you need for a select box. triggerFunction does the work after the user makes a selection. you will need to research this but theres plenty of documentation, you will need to research the POST / GET Ajax functions as well. Jquery makes everything easier, it is good but if your not familiar with JS I would suggest learning pure JS first.

thanks for helping me...