<?php
require_once('functions.php');
$user=$_SESSION['user'];
	$level=$_SESSION['admin_level'];



							if (isset($_GET['id']))
							{
			 	   $dbc=mysqli_connect('localhost','wqvsodvt_porr','@@W!QSER765VBlkj@@@!!','wqvsodvt_point');
						
						$id = $_GET['id'];
						$result = mysqli_query($dbc,("SELECT * FROM products WHERE product_id = $id"));
						
						$row = mysqli_fetch_array($result);
						$id=$row["product_id"];
						$pcode=$row["code"];
						$pname=$row["p_name"];
						$pdesc=$row["description"];
						$pleft=$row["left_p"];
						$vat=$row["vat"];
							$cat=$row["category"];
								$minimum=$row["minimum"];
						$pprice=$row["price"];
							$buying=$row["buying"];
							$comp=$row["company"];
						$re=$row["reorder"];
						mysqli_close($dbc);
						}
						
						?>




<form action="edit.php" method="post">
<input name="m" type="hidden" value="<?php echo $id; ?>"/>
<input name="gg" type="hidden" value="<?php echo $pleft; ?>"/><br />
<? ECHO"<b>Product name:<br />
<input name='p' type='text' value='{$row['p_name']}' size='60'/><br />";?>
<b>QTY:<br />
<input name="qty" type="text" value="<?php echo $pleft; ?>" size="50"/><br />
category:<br />
<input name="cat" type="text" value="<?php echo $cat; ?>" size="50" />
<br />
<?
    $dbc=mysqli_connect('localhost','wqvsodvt_porr','@@W!QSER765VBlkj@@@!!','wqvsodvt_point');
$resul=@mysqli_query($dbc,("select * from accounts
inner join group_accounts on group_accounts.account_id=accounts.id
where group_id='2' and status='ACTIVE' order by name"));
print"<b>Company:</br>";

print"<select name=\"supplier\" required='required'>";
print "<option></option>";
while ($row=mysqli_fetch_assoc($resul)){
$ids=$row['id'];
$names=$row['name'];
print"<option value=$ids>$names\n";
}
print"</select>\n";
print"</p>\n";
?>
Buying price:<br />
<input name="buying" type="text" value="<?php echo $buying; ?>"size="40" /><br />
<br />

Retail selling price:<br />
<input name="ee" type="text" value="<?php echo $pprice; ?>"size="40" /><br />


vat:<br />
<input name="vat" type="text" value="<?php echo $vat; ?>"size="40" /><br />
Wholesale:<br />
<input name="mini" type="text" value="<?php echo $minimum; ?>" size="40"/><br />

<input name="submit" type="submit" value="save">
</form>
