I am trying to call a function via a submit button, but I am unable to submit it.
<!DOCTYPE html>
<html>
<body>
<h2>API Call</h2>
<form method="post" action="display()">
<label for="gid">Global Device ID:</label><br>
<input type="text" id="gid" name="gid" value="m99002021" readonly><br>
<label for="type">Type:</label><br>
<input type="text" id="type" name="type" value="EVNT" readonly><br><br>
<label for="start">Start Date Time:</label><br>
<input type="text" id="start" name="start" value="2020-09-01 00:00:00" readonly><br><br>
<label for="end">End Date Time:</label><br>
<input type="text" id="end" name="end" value="2020-09-30 23:59:59" readonly><br><br>
<input type="submit" value="Execute">
</form>
<?php
function display()
{
echo "hello".$_POST["gid"]."<br>";
echo "hello".$_POST["type"]."<br>";
echo "hello".$_POST["start"]."<br>";
echo "hello".$_POST["end"]."<br>";
}
if($_SERVER['REQUEST_METHOD']=='POST')
{
display();
}
?>
</body>
</html>
When clicking on the execute
button I am getting bellow page
The URL is file:///C:/Users/Faisal/Desktop/display()
Update 1
I have used xampp
for my webserver. Now I am trying to access it via http://localhost/udil/backend/main.php
and it gives me bellow page
when I click on the execute
button I am getting below the page
How can I properly submit it?
Any help would be highly appreciated.