Hi,
I have a row to list mysql table with 2 fields: id, price.
However, I want the column of price in each row can let user input price if the price in table is empty or '0'.
Here is my suedo code:
$query = "SELECT id, price from productprice";
$result = mysql_query($query)
<form enctype="multipart/form-data" name = "priceform" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>
<table>
while(list($id, $price) = mysql_fetch_array($result))
{
?>
<tr>
<td><?php echo $id;?></td>
<td>
<?php
if($price==0)
{
echo '<input type="number" name="price" size="6" maxlength="6" value="1.">';
}
else
{
<?php echo $price;?>
}
?>
</td>
<td><a href="document.priceform.submit(); javascript:CheckPrice('<?php echo $id;?>', '<?php echo $price;?>');">Input</a><noscript><input type="submit" value="finalprice" /></noscript>
</table></form>
<?php
}
}
The 2nd question is there are 2 functions in the text 'input': one is submit button and another one is js.
How should I do it?