I am trying to use multiple buttons in which each perform a different action on a table. For example if you click the 'Add to Sold' button, any checkbox that is selected will have an action performed on it (their status is changed to sold). I have the action php ready to go... however I am unsure how to put it all together so I can have 1 table with 4 different buttons. For right now I am just trying to echo out a statement that will show me that it is working.
Here are the buttons:
<form action="/includes/tester.php" method="POST">
<button class="button2" type="submit" value="runlist" name="runlist"><i class="fa fa-calendar-plus-o" style="color:white; font-size:20px; padding:0px"></i> Add to Runlist</button>
<button class="button2" type="submit" value="sold" name="sold"><i class="fa fa-cart-plus" style="color:white; font-size:20px; padding:0px"></i> Add to Sold</button>
<button class="button2" type="submit" value="shop" name="shop"><i class="fa fa-wrench" style="color:white; font-size:20px; padding:0px"></i> Add to Shop</button>
<button class="button2" type="submit" value="delete" name="delete"><i class="fa fa-trash" style="color:white; font-size:20px; padding:0px"></i> Delete</button>
</form>
Once selected the php document will run called tester.php. Here is the code that I am trying to use for the php to understand which button is pressed.
<?php
if (isset($_POST['runlist'])){
echo 'Runlist pressed';
}
else if (isset($_POST['sold'])){
echo 'sold pressed';
}
else if (isset($_POST['shop'])){
echo 'shop pressed';
}
else if (isset($_POST['delete'])){
echo 'delete pressed';
}
}
?>
Of course I am misunderstanding something because it only works when I have only 1 if statement. Please help, thank you for your time.