I am doing a "list of items I have to ship", with every item and a button "Mark as shipped" for every item.
My problem is that when I press Mark as shipped, one item disappears, but it's not the one I clicked on.. I have to refresh the page to get the see a logical result. I would like to prevent PHP from updating this list because I want to handle that with jQuery. Also, I would like to know how to update $numItemHave2Ship without having to refresh the page (or is it better to do it with jQuery?).
How would I have to do that? Thanks a lot.
here is how my code works:
First I get all the items with MYSQL:
$query=mysql_query("SELECT * FROM items WHERE seller='$username' AND shipped!='1'");
$numItemHave2Ship=mysql_num_rows($query);
echo "You have to ship ".$numItemHave2Ship." items:<p>";
Then, for every item I have:
<input type='hidden' name='item' value='".$row['item']."'>
<input type='submit' class='shipped_button' value='Mark as shipped'>
Then obviously, this button triggers the mysql query:
$query=mysql_query("UPDATE items SET shipped='1' WHERE item='$item'
AND seller='$username'");
EDIT: I have no jQuery code yet. My whole code is in PHP and HTML.