Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello I have a table with users order information.
my admin has 2 buttons in that table they can click
one gives the user a high discount and the other one gives them a low discount.
only problem I'm having is that the buttons don't delete afther they have been clicked.

here is that part of the table
PHP
<pre> echo "
              <td>
              ";
              if($row['hoge_korting']==1){
                echo "Hoge korting";
              }else{
                echo "Korting";
              }
               echo "<br>
                <a class='btn btn-success' name='bevestigen' href='bevestigen.php?order_ID=".$row['order_ID']."&hoge_korting=1&email=".$row['email']."&naam=".$row['naam']."' role='button'> Ja </a> //hight discunt yes
                <a class='btn btn-danger' name='afwijzen' href='afwijzen.php?order_ID=".$row['order_ID']."&hoge_korting=0' role='button'> Nee </a> //high_discoun no

              </td>"; 


this however shows the table like this
high discount?
_____________
high discount
[yes] [no]

I want something like this afther button has been clicked
high discount?
_____________
high discount

What I have tried:

I tries putting the button information in the if statement but then it either gives all of them
$row['hoge_korting']==1
or all of them
$row['hoge_korting']==0

tried looking it up on the internet but they are talking about deleting the row. I don't want to delete the row I just want to update/edit it
Posted
Updated 24-Jan-23 23:06pm
v3
Comments
Andre Oosthuizen 25-Jan-23 5:18am    
Not sure what you mean by the "button does not delete"?
Do you want to hide the button based on either one clicked, or do you want to hide the row in the table based on which button clicked?
You also mention you want to update the record from the row selected, does the buttons have something to do with this as per your bevestigen.php or afwijzen.php?
Rebecca2002 25-Jan-23 5:25am    
so what I want is if user clicks a button the variable hoge_korting aka high discount in the table. changes from a 0 to a 1 and reverse. this works perfectly but the problem is I don't have a nice way of showing admin that hoge_korting has changed from a 0 to 1. I had this idea of: if user clicks high discount yes then go to my update script bevestigen and enter it into the db + send the row an email. then go back to the table and delete the buttons or show a way so that the user knows if row 1 has a high discount of 1 or 0
[no name] 26-Jan-23 13:32pm    
"Deleting" usually has side-effect; can't you just "hide" (change visibility) or collapse (height = 0) the buttons?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900