I have a form with 2 field types.
1) a text box
2) a dropdown listbox
I am trying to run a search of the database so that I can edit a record.
My problem is that I can not display the records on the form.
The form contains a field called order_naumber
A number is put into this field, the submit button is hit and the records should appear in the relevent boxes.
I have pasted the code I am using below.
Secondly I need the dropdown list box to appear with the data from the database. The user may decide to choose another option from the droplist.
Thanks in advance for any help received
<html>
<body>
<form method="POST" action="<b>Order Details:</b><input type="Text" name="order_details" value="<?php echo $myrow4[Order_Desc] ?>"><br><br>
<b>Enter Order Number:</b><input type="Text" name="order_number"><br><br>
<?php // begin php code
$db = mysql_connect("10.40.1.1", "root", "" or die ('Cannot connect to database');
mysql_select_db("Logo_Dept",$db) or die ('database not available');
$sql='SELECT Product_Cat FROM product_category';
$result = mysql_query($sql,$db);
echo "<select name=product_category>\n";
while ($row = mysql_fetch_array($result)) {
echo "<option value=$row[0]>$row[0]</option>\n";
}
echo "</select>\n";
?>
<input type="Submit" name="submit">
</form>
<?php
if(isset($_POST[submit])){
$db = mysql_connect("localhost", "root"
mysql_select_db("records",$db);
$sql4 = "Select * from record_information Where (left(Order_Desc,7))= $_POST[order_number]";
$result4=mysql_query($sql4,$db);
$myrow4=mysql_fetch_array($result4);
}
?>
</body>
</html
1) a text box
2) a dropdown listbox
I am trying to run a search of the database so that I can edit a record.
My problem is that I can not display the records on the form.
The form contains a field called order_naumber
A number is put into this field, the submit button is hit and the records should appear in the relevent boxes.
I have pasted the code I am using below.
Secondly I need the dropdown list box to appear with the data from the database. The user may decide to choose another option from the droplist.
Thanks in advance for any help received
<html>
<body>
<form method="POST" action="<b>Order Details:</b><input type="Text" name="order_details" value="<?php echo $myrow4[Order_Desc] ?>"><br><br>
<b>Enter Order Number:</b><input type="Text" name="order_number"><br><br>
<?php // begin php code
$db = mysql_connect("10.40.1.1", "root", "" or die ('Cannot connect to database');
mysql_select_db("Logo_Dept",$db) or die ('database not available');
$sql='SELECT Product_Cat FROM product_category';
$result = mysql_query($sql,$db);
echo "<select name=product_category>\n";
while ($row = mysql_fetch_array($result)) {
echo "<option value=$row[0]>$row[0]</option>\n";
}
echo "</select>\n";
?>
<input type="Submit" name="submit">
</form>
<?php
if(isset($_POST[submit])){
$db = mysql_connect("localhost", "root"
mysql_select_db("records",$db);
$sql4 = "Select * from record_information Where (left(Order_Desc,7))= $_POST[order_number]";
$result4=mysql_query($sql4,$db);
$myrow4=mysql_fetch_array($result4);
}
?>
</body>
</html