php script in elementor – WordPress Development Stack Exchange
Question
How would one add a php script like the one below in elementor?
<?php
//if the submit button is clicked, follow logic to insert record
if (isset($_POST['submit'])) {
$insert_value = 1;
//make a database connection
$conn = mysqli_connect('localhost', 'myuser', 'mypassword', 'motordata');
//prepared statement to insert the record
$stmt_insert_record = $conn->prepare("INSERT INTO MotorOn (command) VALUES (?)");
$stmt_insert_record->bind_param("i", $insert_value);
$stmt_insert_record->execute();
$stmt_insert_record->close();
}
?>
<!-- Form that will submit to the document's address ie. the same page-->
<form method="post">
<input type="submit" value="Shutdown" style="background-color: red;">
</form>
0
11 months
2022-03-11T20:53:28-05:00
2022-03-11T20:53:28-05:00 0 Answers
0 views
0
Leave an answer