<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<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>
</select><br/><br/><br/>
</form>
<?php
if(isset($_POST['s_product']))
{
$product=$_POST['s_product'];
$sql = "SELECT * FROM `data` join product on data.p_id=product.p_id WHERE data.p_id=$product";
?>
<table width="100%" height="25%" >
<tr>
<td><h3>Diller Name</h3></td>
<td><h3>phone Number</h3></td>
<td><h3>Date</h3></td>
<td><h3>Invoice Number</h3></td>
<td><h3>Product Name</h3></td>
</tr>
<?php
$query=mysql_query($sql);
while($query2=mysql_fetch_array($query))
{
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>";
}
}
?>
</table>
</body>
</html>
Anup_2
0
Newbie Poster
Recommended Answers
Jump to PostAdd 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.
All 3 Replies
cereal
1,524
Nearly a Senior Poster
Featured Poster
moneeshot
0
Newbie Poster
Anup_2
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.