hi,
i have this simple form, the file is named 'home.php':
<html>
<header>
<title>Home</title>
</header>
<body>
<form method = post action = 'home.php'>
<input type = text name = 'test'>
<input type = submit name = 'submit'>
</form>
</body>
</HTML>
<?php
if ($_POST["submit"]) {
echo $_POST["test"];
}
?>
As you can see the 'action' of the form is itself but it doesn't work. If i put action='another.php' and put the above php code in this 'another.php' file it works.
I would like to stay in the same page with the form and the result of clicking the submit button, is there a way to do that?
Thanks.
i have this simple form, the file is named 'home.php':
<html>
<header>
<title>Home</title>
</header>
<body>
<form method = post action = 'home.php'>
<input type = text name = 'test'>
<input type = submit name = 'submit'>
</form>
</body>
</HTML>
<?php
if ($_POST["submit"]) {
echo $_POST["test"];
}
?>
As you can see the 'action' of the form is itself but it doesn't work. If i put action='another.php' and put the above php code in this 'another.php' file it works.
I would like to stay in the same page with the form and the result of clicking the submit button, is there a way to do that?
Thanks.