I'm trying to stop writing any new PHP. Instead I want to try to use mod harbour. Look at this simple sample code below and help me translate the <php> part to <prg> mod harbour. PHP function IsSet() simply tells the script if a value exists in the POST hash like using hb_isHash( h ) .and. hhaskey( h, 'accept' ).
Can someone help?
- Code: Select all Expand view RUN
<!DOCTYPE html>
<html>
<head>
<title>Buttons with Actions</title>
<style>
/* Styling for the buttons */
.button {
display: inline-block;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
}
.accept {
background-color: green;
color: white;
}
.cancel {
background-color: red;
color: white;
}
</style>
</head>
<body>
<h1>Hello there!</h1>
<p>Please click on one of the buttons below:</p>
<form method="post">
<button class="button accept" type="submit" name="accept" value="true">Accept</button>
<button class="button cancel" type="submit" name="cancel" value="true">Cancel</button>
</form>
<?php
if (isset($_POST['accept'])) {
// execute some action when accept button is clicked
echo "<p>You clicked the accept button.</p>";
} elseif (isset($_POST['cancel'])) {
// execute some action when cancel button is clicked
echo "<p>You clicked the cancel button.</p>";
}
?>
</body>
</html>