<?php
include("dbconfig.php");
$pid=$_GET ['pid'];
$q="SELECT * FROM product where pid='$pid' ";
$result=mysql_query($q);
$row=mysql_fetch_assoc($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
function m(){
//alert(document.form1.tedad.options[document.form1.tedad.selectedIndex].value);
var x=document.form1.tedad.options[document.form1.tedad.selectedIndex].value;
var sum=(x*<?php $row['price'];?>);
document.getElementById('total').value=sum;
}
</script>
</head>
<body>
<form name="form1" id="form1" method="post" action="">
<table width="522" height="60" border="1">
<tr>
<td><table width="522" height="60" border="1">
<tr>
<td width="203" align="center" bgcolor="#FF9999">جمع کل</td>
<td width="104" align="center" bgcolor="#FF9999">تعداد</td>
<td width="108" align="center" bgcolor="#FF9999">قیمت</td>
<td width="79" align="center" bgcolor="#FF9999">نام کالا</td>
</tr>
<tr>
<td id="total1"align="center">
<input type="text" name="total" id="total" /></td>
<td align="center">
<?php
for($i=1;$i<20;$i++)
?>
<select name="tedad" id="tedad" onchange="m()">
<option>-----</option>
<?php for($i=1;$i<20;$i++){?>
<option value="<?php $i?>" ><?php echo $i; ?></option>
<?php } ?>
</select></td>
<td align="center"><?php echo $row['price'];?></td>
<td align="center"><?php echo $row['name'];?></td>
</tr>
<tr>
<td colspan="4" align="center" bgcolor="#FF9999"><input type="submit" name="insert" id="insert" value="افزودن به سبد خرید" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>