I use the Select form to update the orderstatus field from the table.

<?php
session_start();
if($_SESSION['usertype'] !== 'admin')
{
	header("location:index.php?page=loginpage.php");
}

include('includes/ordercontrolbuttons.php');
include('includes/connect.php');
mysql_select_db("al",$con);

$result = mysql_query("SELECT * FROM orders");

echo "<form action='orderstatusadmin.php' method='post'>";
echo "<table border=1 cellspacing=0 cellpadding=5 class='orderlist'>";

echo "<tr><th>Order Number</th>";
echo "<th>Name</td>";
echo "<th>Order Detail</th>";
echo "<th>Order Status</th>";
echo "<th>Order Amount (Php)</th></tr>";

while($row = mysql_fetch_array($result))
{
	echo "<tr><td align='center'><input type='hidden' name='ordernumber' value='".$row['ordernumber']."'>".$row['ordernumber']."</td>";
	echo "<td align='center'>".$row['name']."</td>";
	echo "<td align='center'>".$row['orderdetail']."</td>";
	echo "<td align='center'><br/>".$row['orderstatus']."<br/><br/>
	<select name='orderstatus'>
	<option>-Select Order Status-</option>
	<option value='Pending'>Pending</option>
	<option value='On Process'>On Process</option>
	<option value='Ready to Pick-up/Deliver'>Ready to Pick-up/Deliver</option>
	<option value='Deny Order'>Deny Order</option>
	</select><br/><input type='submit' value='Change'>
	</td>";
	echo "<td align='center'>".$row['orderamount']."</td></tr>";
}

echo "</table>";
echo "</form>";

mysql_close($con);

?>

orderstatusadmin.php

<?php

include('includes/connect.php');
mysql_select_db("al",$con);

$ordernumber = $_POST['ordernumber'];
$orderstatus = $_POST['orderstatus'];

mysql_query("UPDATE orders SET orderstatus='$orderstatus' WHERE ordernumber='$ordernumber'");

header("location:indexadmin.php?page=orderlistadmin.php");

mysql_close($con);
?>

The problem is every time i select an option from a row, the -Select Order Status- will apear in the Order Status of the next row, but the last row function right.

I have no idea what your trying to say.
could you please explain the last part a little better. (The problem is every time i select an option from a row, the -Select Order Status- will apear in the Order Status of the next row, but the last row function right.)

are you saying that when you submit the form the -Select order Status- is inserted into the DB for the next record?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.