Hello,
I'm practicing PHP-coding, and creating portal for common repository. I have doing this just about 3-weeks, so i'm not so professional of it, yet.
Now im stuck with dropdown selection. As seen from code below. It query data from table, and get values, but not adding them to correct input fields.
Something is incorrectly coded. Any ideas to make it working?
This portal target is, to functioning without any additional code, like java-scripts. Pure PHP only.
Here is the part of nonworking code:
<?php
include '/csrconn.php';
$query = mysql_query("SELECT ProductName, ProductItem, RetailPrice FROM `product` ORDER BY ProductName ASC");
$ProdQuery="SELECT ProductName, ProductItem, RetailPrice FROM product";
$ProdResult=mysql_query($ProdQuery) or die ("Query to get data from firsttable failed: ".mysql_error());
echo "<option>--- Select Product ---></option>";
while ($prodrow=mysql_fetch_array($ProdResult)) {
$ProductName=$prodrow["ProductName"];
$ProductItem=$prodrow["ProductItem"];
$RetailPrice=$prodrow["RetailPrice"];
echo "<option>$ProductName</option>";
}
?>
<tr><td>Product Item: </td><td><input name="ProductItem" type="text" id="ProductItem" value="<?php echo($prodrow['ProductItem']); ?>" id="ProductItem"></td></tr>
<tr><td>Retail Price: </td><td><input name="RetailPrice" type="text" id="RetailPrice" value="<?php echo($prodrow['RetailPrice']); ?>" id="RetailPrice"></td></tr>
<tr><td>Offer ID: </td><td><input name="OfferID" type="text" id="OfferID" autofocus="autofocus"></td></tr>
<tr><td>Customer Name: </td><td><input name="CustName" type="text" id="CustName"></td></tr>
<tr><td>Customer Number: </td><td><input name="CustNum" type="text" id="CustNum"></td></tr>
<tr><td>Customer Phone: </td><td><input name="CustPhone" type="text" id="CustPhone"></td></tr>
<tr><td>Customer Email: </td><td><input name="CustEmail" type="text" id="CustEmail"></td></tr>
<tr><td>Provider: </td><td><input name="Provider" type="text" id="Provider"></td></tr>
<tr><td>Ordered Amount: </td><td><input name="OrderedAmt" type="text" id="OrderedAmt"></td></tr>
<td>Order Status: </td><td>
<select name="OrderStatus" type="text" id="OrderStatus">
<option value="Processing">Processing</option>}
<option value="Active">Active</option>
<option value="Removed">Removed</option>
</select></td>
<tr><td><input name="add" type="submit" class="more right" id="add"></td></tr>
</table>
</form>
<p>
<?php
}
?>