PHP Functions: Buttons
Use button-related functions by including /_framework/functions/x_button.php
.
Dependencies
- PHP 7.1-7.4
- PHP 8.0-8.4
PHP-Modules
mysqli
: If usingx_executionButton()
Function | Description | Explanation |
---|---|---|
x_executionButton($db, $name, $url, $query, $get, $msgerr = "Fehler!", $msgok = "Erfolgreich!", $break = false, $style = "") |
Creates an execution button that performs a database query when clicked and refreshes the page. | The function constructs a URL with the specified $get parameter and generates an anchor tag (<a> ) styled as a button. If the URL contains the query parameter ? , it appends the $get parameter; otherwise, it adds it. If the button is clicked, it checks for the $get parameter in $_GET . If found, it executes the given SQL query using the database connection ($db ). If successful, it refreshes the page with the updated URL after removing the $get parameter. |
x_button($name, $url, $break = false, $style = "", $reacttourl = true) |
Creates a simple button that links to a specified URL, optionally applying a different style if the current URL matches the link. | The function generates an anchor tag (<a> ) styled as a button, with the specified $url and $name . If $reacttourl is true and the current URL matches the $url , the button style is modified to indicate it as inactive. Optionally, the button can be followed by a line break if $break is true . |