How to handle Frameset, POST & Re-Direct [closed]
I am using FrameSets to divide screen into two panes. The left pane displays links whereas the right pane displays the actual pages. I want to know how to handle the issue when an entry Form is opened on the right-pane and submitted.
When I submit a Form, the action is passed to another .php file, which saves the records into MySQL database and must return to the same entry Form on the right pane.
The problem is that after saving, it blanks the screen and I am worried that if it returns, it might display the Entry form on the whole screen instead of the right-pane.
Please assist me on how to handle this.
In your right pane, you have a form that sends a POST request to a php file. That request has a target right from the beginning, the place where the browser will collect the response of the server. If this target is your right pane, then the response of the php file (the new form) will be displayed in your right pane.
<frameset>
<frame id="leftpane" src="leftpane.php"></frame>
<frame id="rightpane" src="rightpane.php"></form>
</frame>
rightpane.php
...
<form action="rightpane.php" target="rightpane" method="post">
...
</form>
...
I'm not entirely clear about your situation but a few pointers:
- You can refresh a neighboring frame after submit through Javascript if they come from the same domain.
- You can submit from within a frame into the whole window (allowing for a full refresh) using
target="_top"
. - I think you can submit into a neighboring frame by using
target="framename"
.
You can specify the "target" attribute for your form. It controls, in what frame your output will be displayed after processing the form submission.
But I would highly recommend not to use frames! It's better to give structure to your page with the correct HTML elements elements and format everything with CSS.
精彩评论