Untitled
unknown
plain_text
a year ago
1.7 kB
5
Indexable
create table product(itemcode varchar(5),itemname varchar(15),unit price varchar(10));
<!-- html file (product.html) -->
<html>
<body align="center">
<h1>Product Details</h1><br><br>
<form action="prod_details.php" method="get">
Item Code:
<input type="text" name="icode"><br><br>
Item Name:
<input type="text" name="iname"><br><br>
Unit Price:
<input type="text" name="unitprice"><br><br>
<input type="submit" value="ADD"
</form>
</body>
</html>
<!-- PHP file(prod_details.php) -->
<?php
$code=$_GET['icode'];
$name=$_GET['iname'];
$unit=$_GET['unitprice'];
$dbconn=pg_connect("host=localhost port=5433 dbname=postgres user=postgres user=postgres password=devagiri");
if($db){
$iqry="insert into product value('$code','$name','$unit')";
$insert=pg_query($dbconn,$iqry);
$qry="select *from product";
$select=pg_query($dbconn,$qry);
echo"<body>
<center>
<h1>Product Details</h1>
</center>";
echo "<br><br>
<table border="2" align="center" width="50%"> ";
echo"<tr>
<th>Product Code</th>
<th>Prodcut Name</th>
<th>Unit Price</th>
</tr>";
while($row=pg_fetch_row($select)){
echo"<tr>";
echo"<td>$row[0]</td>";
echo"<td>$row[1]</td>";
echo"<td>$row[2]</td>";
echo"</tr>
}
echo"</table></body>";
}
?>Editor is loading...
Leave a Comment