Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

How does Oscommerce refrence admin/orders.php specific data


Recommended Posts

On the admin/orders.php page we have a list of orders. I have looked at the code and don't quite understand how this list is generated in a way so that when you click "edit" it selects that single order. How do you generate a dynamic list like this but still keep something unique so you can reference a single row.


I'm trying to do something similar and can't figure out how to generate a list with either a foreach or while loop but maintain a reference-able attribute so if you click an edit button it can single out that order id. Since the loop always wants to reference the last thing it spit out.


I've been mulling this over for a couple days now and thought the best solution was to give the edit button a unique ID and then use javascript to get getElementById but then I realized that it isn't needed.


Here is the page


You should see an edit button for each row, but I just can't think of a way to tell php to get "the row" in which the button is.

This is the code used to generate the rows

//////////////// FIND ALL UN-ASSIGNED RFQ's ////////////////
if (isset($_GET['NotAss'])){
$sqlNOAS="SELECT * FROM rfq where status='un-assigned' Order by rfq_id ASC";
echo "<table border='0'>
<th>RFQ Number</th>
<th>Customer Name</th>
<th>Company Name</th>
<th>Part Number</th>
<th>Assigned To</th>
while ($row=mysql_fetch_array($resultNOAS)) {
echo "<tr>";
echo "<td>" . $row['rfq_id'] . "</td>";
echo "<td>" . $row['rfq_date'] . "</td>";
echo "<td>" . $row['rfq_name'] . "</td>";
echo "<td>" . $row['rfq_company'] . "</td>";
echo "<td>" . $row['rfq_model'] . "</td>";
echo "<td>" . $row['status'] . "</td>";
echo "<td>" . "<input type='button' value='edit' name=\"$row['rfq_id']'\">" . "</td>";
echo "</tr>";
echo "</table>";


In here you'll notice that I was thinking giving the Edit button the name of the rfq_id (it's unique) was the way to go, but it is still generated in the loop. The only way I know of to reference it is with javascript which I'd like to avoid if possible.


Any help is appreciate.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...