|
-
Jun 15th, 2008, 03:27 PM
#1
Thread Starter
Lively Member
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
Last edited by sridharao; Jun 15th, 2008 at 03:56 PM.
-
Jun 15th, 2008, 03:54 PM
#2
Hyperactive Member
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?
» Twitter: @rudi_visser : Website: www.rudiv.se «
If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.
-
Jun 15th, 2008, 04:08 PM
#3
Thread Starter
Lively Member
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.
-
Jun 15th, 2008, 04:15 PM
#4
Thread Starter
Lively Member
Re: Loading new page in same page
I was not aware that closing quote can be so far away <?php } ?>
Last edited by sridharao; Jun 15th, 2008 at 04:19 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|