How to pass variables from embedded pages to themselves
Posted: Wed Jun 22, 2005 6:20 pm
I have a page with an index on the left and content on the right (like everybody's dog). My content on the right can be one of multiple pages, each of which has forms for uploading files and other information. When I hit submit on the form I want the variables, which will be passed to the parent page, to be handed back to the embedded pages to handle.
code snippet from parent page:
--------------------------------------------
code snippet from photomgr.php
I realize now that $_SERVER['PHP_SELF'] will be the value of the parent. My question is the right way to have the parent pass along the variables to photomgr.php to handle (so my code for handling all photo stuff is in the photomgr page, not in the parent).
Should the parent parse all the variables and then re-create the list when it loads the client page? Is there a more elegant approach?
Much thanks for any hints.
JCART | Please use
code snippet from parent page:
Code: Select all
<table cols="e;2"e;>
<tr>
<td> <?php include ('sidebar.html'); ?> </td>
<td> <?php loadPage(); ?> </td>
</tr>
</table>
<?php
function loadPage() {
switch ($_GETї'pg']) {
include ('photomgr.php');
} else {
include ('moviemgr.php');
} else ...
}code snippet from photomgr.php
Code: Select all
<form name="e;photoListForm"e; method="e;get"e; enctype="e;multipart/form-data"e;
action="e;$_SERVERї'PHP_SELF'];"e; onSubmit="e;return checkMe(this)"e;>
<table>
<tr> <td>Photo Directories</td> </tr>
<tr><td colspan=2>Select a photo topic below to edit</td></tr>
<tr><td width=120> <?php <load up a list of stuff> ?> </td>
<td>
<input type="e;submit"e; name="e;commitPhoto"e; value="e; Commit "e;>
</td>
</tr></table>Should the parent parse all the variables and then re-create the list when it loads the client page? Is there a more elegant approach?
Much thanks for any hints.
JCART | Please use
Code: Select all
tags when posting php code. Review [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
[b]chefebe[/b] | Thanks, sorry. I originally surrounded just the php code and it looked awkward so I removed it. Didn't think about surrounding <all> code that has any php in it. My bad.