Loading new page in same page
When the user visits the page, he is presented with a form. when he submits the form, the results should be displayed in the same page. How do I do that?
<html>
<?php
if (isset($_POST["subm"]))
..
..
..
code to display result
..
..
?>
<html>
form goes here
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
..
..
<input type="submit" value="Identify" name="subm">
</html>
In this setup, only the form will be visible when the page loads for the first time. When user clicks form, the result will show up on the same page. but the form too is displayed. How do I get rid of that? Hitting back button, the user should go back to the form and make changes.
I tried 2-page method, now I want it in one page only. I saw it being done somewhere using if... else.. way. On Load the the the page would check for POST using isset(), if not set (as during first time loading) load form, else (after form submission) show only the generated results (not the form). How can I do it using if..else
Re: Loading new page in same page
PHP Code:
<html>
...
<?php
if(isset($_POST['subm'])) {
// handle
} else {
?>
...
form
...
<?php } ?>
...
</html>
You're saying that doesn't work?
Re: Loading new page in same page
Yes, that is exactly the solution I was looking for. Thanks! Coincidentally, I found solution at http://forums.whirlpool.net.au/forum...fm/508802.html and implemented it already.
Re: Loading new page in same page
I was not aware that closing quote can be so far away <?php } ?>