Hi,
I have text fields that are given the value from an sql query. I get the values of these text boxes and add them to a database.
This might sound like a bit of a loop, but when the text fields originally populate I want to user to be able to change the text field and then update the database.
product_details.php
<form method="get" name="proddetailsform"><form method="get" name="proddetailsform">
$q = "SELECT * FROM product where prodid = '".$_GET['prodid']."' ORDER BY prodname";
$res = mysql_query($q) or die(mysql_error());
while($r=mysql_fetch_array($res))
{
?>
<p>Code:<br /><input name="prodcode" type="text" value="<?php echo $r['prodcode']?>">
<p>Product Name:<br /><input name="prodname" type="text" value="<?php echo $r['prodname']?>"></p>
<input name="updateproduct" type="submit" value="Save product updates"onclick="javascript: form.action='product_update.php';" />
</form>
product_update.php
<?php
require "session_logincheck.php";
require "connect.php";
$prodID = $_GET['prodid'];
$prodCode = $_GET['prodname'];
$prodCompID = $_GET['prodcompid'];
$query = "update product set prodcode = '".$prodCode."',
prodcompid = '".$prodCompID."' where prodid = ".$prodID;
$result = @mysql_query($query, $connection)or die ("Unable to perform query<br>$query");
header("Location: product_page.php");
exit();
?>
Error: Unable to perform query
update product set prodcode = '', prodcompid = '' where prodid =
product_details.php is wrapped in a function which is called by another function that contains the list box prodid
appreciate any help!