Help - Search - Members - Calendar
Full Version: Problem with frames and PHP
Weborum Webmaster Forum > Web Page Design > HTML
sjthomas
OK so I am using frames but there is a very good reason. I'm building a web based app as opposed to a site and it will more than likely never go public, so I think its ok. Basically I havn't used frames since my very first site about 5 years ago and have kinda forgotten how to. I can get the basic site to work fine but I'm having a bit of a problem using forms and frames. Basically I have a form in the left frame that has the target of the main frame and the action set as the php page contained within the main frame. What I want it to do is submit the info to the main frame and have the related dynamic content displayed in the main frame. Thats not happening, what is happening is that a new window is being opened with the dynamic content. The code I've got is below:

frameset code:
CODE
<frameset rows="*" cols="200,*" frameborder="NO" border="0" framespacing="0">
 <frame src="leftframe.php" name="leftFrame" scrolling="NO" noresize>
 <frameset rows="*,80" frameborder="NO" border="0" framespacing="0">
   <frame src="mainframe.php" name="mainFrame">
   <frame src="bottomframe.php" name="bottomFrame" scrolling="NO" noresize>
 </frameset>
</frameset>


leftframe.php code:
CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
color: #0000FF;
background-color: #CCCCCC;
font-size: 11px;
}

h1 {
font-size: 14px;
}
-->
</style>
</head>

<body>
Please use the controls below:<br /><br />
<form action="mainframe.php" method="post" name="add_nodes" target="mainFrame">
<h1>Add a node:</h1>
<input name="node_name" type="text" /><br />
<input name="submitted" type="hidden" value="true" />
<input name="action" type="hidden" value="add" />
<input name="Add" type="submit" value="Add" />
</form>
</body>
</html>


Can anyone see what I'm doing wrong?

Cheers.
Joe
This tutorial should help you with the frames.

As for the form, it looks good. Whats the code inside mainframe.php?
sjthomas
Actually it just started working! I think I must have changed something and not realised it!

On the plus side its certainly reminded we I hate frames so much *shudder*

Cheers for the link though.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.