Hey, I’m making a script that checks if a specified string matches the one in check.php. Here is my HTML code:
<form name="input" action="check.php" method="POST" id="key">
Key: <input type="text" name="key" />
<input type="submit" value="Submit" />
</form>
However, when it runs check.php it goes to the default white page. Is there a way to get the result to display on the page where they typed the information on, like at the top or bottom? Here is my check.php (just for testing atm):
<?php
$key=$_POST['key'];
echo $key;
?>
In the most simple example here, rename your .html file .php. Now paste the PHP script into the body of your old HTML document. Change the action of the form to point to blank (this will send the form to the same document). Now your form doc also outputs the $_POST[‘key’]. If the $_POST[‘key’] value is empty… you echo nothing. You may get a warning message, but no harm.