How to run a PHP function due to a button click with button data passed

0 votes

I manage some sortiment items on a page, they get displayed with a PHP script. I want an admin page that "toggle" via a sortiment table to display or not display an item. 
Scenario: if the button is clicked, I would like to start a php-skript. There should be a value passed to that script from where the button was clicked.
The table entry looks like this:

<tr>
    <td>Himbeerhonig</td>
    <td id="himbeerhonig">Ja</td>
    <td><button type="button" id="himbeerhonig" onclick="function()">press me to execute function</button></td>
</tr>```

(possible PHP pseudocode)
open SQL connection
   look for database entry based on the passed ID
   change the value of the found entry (!currentValue)
close SQL connection

*optionally*
refresh the <td id="himbeerhonig"> with the updated value. 

Can someone help me do this?

May 28, 2022 in PHP by Kichu
• 19,040 points
3,966 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
0 answers

How to call a PHP function on the click of a button

The two buttons on my functioncalling.php page ...READ MORE

Jul 24, 2022 in PHP by Kithuzzz
• 38,000 points
10,901 views
0 votes
0 answers

How to filter data from a MySQL Database Table with PHP

I'm attempting to code a search box ...READ MORE

Jul 22, 2022 in PHP by narikkadan
• 63,600 points
6,652 views
0 votes
1 answer

How to Validate Form Data With PHP?

Hey @kartik, The first thing we will do ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,840 points
3,317 views
0 votes
1 answer

What is a Cookie? How to create Cookies With PHP?

A cookie is often used to identify ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,840 points
3,792 views
0 votes
0 answers
0 votes
1 answer

How to Execute PHP function with onclick?

Hello @kartik, In javascript, make an ajax function, function ...READ MORE

answered Jun 16, 2020 in PHP by Niroj
• 82,840 points
22,810 views
0 votes
1 answer

Convert Excel's "41014" date to actual date in PHP or JavaScript

PHPExcel Date handling code: public static function ExcelToPHP($dateValue ...READ MORE

answered Oct 24, 2022 in Others by narikkadan
• 63,600 points
4,405 views
0 votes
1 answer

Why is not preferable to use mysql_* functions in PHP?

The reasons are as follows: The MySQL extension: Does ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,250 points
1,268 views
0 votes
2 answers
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP