>
>  So, I had this all wrong before. Basically, I need two forms, right? One
>> on my originating page, and one on the page within the frameset I want to
>> pass the values to. Correct?
>>
>> My form, which I named my_search has one input field, which I named query.
>> In the javascript, I put in this:
>>
>> <script type="text/javascript">
>> function submitForm(var1,var2) {
>>  top.mainFrame.document.my_search.query.value = var1;
>>  top.mainFrame.document.my_search.submit();
>>  document.search_form.submit();
>> }
>> </script>
>>
>> In the framset named mainFrame, I have a page which matches the form on
>> the originating page.
>>
>> Am I on the right track? When I click on the search link, nothing happens.
>
>
mainFrame should not be the name of your frameset.  Say I have a frameset
with three sections. Top, Left, and Right...you will actually have 4 pages.

Frameset.php //The top level of the frameset that doesn't do much more than
assign the Frame names and pages associated with them
TopSection.php //Anything on this page will be displayed in your top frame
LeftSection.php // Anything on this page will be displayed in your left
frame
RightSection.php //Anything on this page will be displayed in your right
frame

In order to see the names assigned to your different frames you need to open
Frameset.php and look for them.

It will look something like this:

<frameset rows="200,*" cols="*" framespacing="0" frameborder="NO"
border="1">
  <frame src="TopSection.php" name="topFrame" scrolling="NO" noresize >
  <frame src="LeftSection.php" name="leftFrame">
  <frame src="RightSection.php" name="rightFrame">
</frameset>

You should never need to reference Framset.php directly.

Say I wanted to pass a value from TopSection.php to a text field in
LeftSection.php I would do this:

TopSection.php
<form name="search_form" method="post" action="<?php echo
$_SERVER['PHP_SELF']; ?>">
<input type="text" name="search_name" value=""> //The default value will be
blank but will change if someone enters in text.
</form>

//Now the persons submits the form and you want the search name to populate
to your other frame.
<a
href="javascript:submitForm(document.search_form.search_name.value)">SEARCH</a>

//The Javascript function this calls will pass the
document.search_form.search_name.value to the new form
function submitForm(name) {
 top.leftFrame.document.my_search.search_name.value = name;
 document.search_form.submit();
}
//top goes to the highest level of your frameset, leftFrame is the frame
name specified for LeftSection.php on your Frameset.php page,
document.my_search is the name of your form in
//LeftSection.php, search_name is the name of your text field within the
form in LeftSection.php

//Your TopSection.php form has now passed the search_name value to the
LeftSection.php page

LeftSection.php
<form name="my_search" method="post" action="">
<input type="text" name="search_name" value="">
</form>

That should be enough to get you going.  If you have any further questions
lets take this "Off List" since it does not relate to PHP.

Dan

Reply via email to