How to get the value in my form
Notice that my form action is empty. My goal is to put a query in this
same page. How can I achieve that? How do I get the value in my form.
Here is my code:
<html>
<body>
<form action="" method="GET">
<table border="1" cellpadding="5" align="center">
<tr>
<td>Quantity:</td>
<td><input type="text" name="add_qty"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" Value="Add"></td>
</tr>
/table>
</form>
</body>
</html>
<?php
// connect to the database
include('connect-db.php');
// check if the 'id' variable is set in URL, and check that it is
valid
if (isset($_GET['machine_no_id']) &&
is_numeric($_GET['machine_no_id']))
{
// get id value
$id = $_GET['machine_no_id'];
$qty = $_GET[''];
echo $id;
echo $qty;
//mysql_query("UPDATE master_tbl SET qty_left = qty_left + '$qty'
WHERE machine_no_id='$id'");
//header("location: show_result.php");
}
?>
No comments:
Post a Comment