View Full Version : retrieving data from a drop down box for modifying

01-19-2004, 02:54 AM
I am doing this script for admin purpose:
I am retrieving data from mysql to a drop down box. The drop down box is populated with product name.

My problem is how can I select the product name and display the details (productname, details, price) on the next page to a text box for update purposes.

There are two pages, one is update.php which gets the data to a drop down box with a submit button.

The other updatedata.php with text fields populated with data select from the previous drop down box with a update button.

Can you guys help me to check my code and if there's a tutorial regarding this feature, please recommend to me. Thank you-----------------------------------------------------------------

update.php code below
$query = "select proname from products order by proname";

$result = mysql_query($query) or die(mysql_error());

//create form containing selection list

print "<form action='updatedata.php' method='get'> \n";

print "<select name='proname' size='6'> \n";



print "<option value='$row'>$row</option> \n";


print "</Select> \n";
print "<input type='submit' value='Select product to modify'> </form> \n";// Submit Button

updatadata.php code is below

$query=" SELECT * FROM products WHERE proname='$proname'";

while ($i < $num) {

<form action="updated.php" method="post">
Product Name: <input type="text" value="pron" value="<? echo "$proname"?>"><br>
Details: <input type="text" value="pdetails" value="<? echo "$details"?>"><br>
Product Price: <input type="text" value="pprice" value="<? echo "$price"?>"><br>
<input type="Submit" value="Update">