Re: Passing variable to a page in a frameset

From: Date: Thu, 14 Aug 2008 21:06:35 +0000
Subject: Re: Passing variable to a page in a frameset
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-278096@lists.php.net to get a copy of this message
On Thu, Aug 14, 2008 at 3:43 PM, Dan Shirah <mrsquash2@gmail.com> wrote: >> > Hello, >> > >> > I've got a website here: >> > http://beta.menashalibrary.org/about >> > >> > On every page, i've got a search box at the top. This search box >> > searches >> > the library's web catalog. The problem is, when someone searches, it >> > takes >> > them away from the site. What I'd like to do is take what a person >> > searches >> > for, and load it into the bottom frame of this page: >> > >> > >> > >> > http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html >> > >> > Is there a way, with php, to take what someone puts in the search box >> > and >> > put the results into the bottom frame of a frameset when the originating >> > page does not contain frames? >> > >> > - jody > > Bastien is right, this is more of a Javascript issue. > > It can be accomplished very easily by doing the following. > > Once the user enters the search criteria have the submit button/link call a > javascript function like the following: > > function submitForm(var1,var2) { > top.leftFrame.document.my_search.text1.value = var1; > top.leftFrame.document.my_search.text2.value = var2; > top.leftFrame.document.my_search.submit(); > document.search_form.submit(); > } > > And this would be your submit link: > > <a > > href="javascript:submitForm(document.search_form.var1.value,document.search_form.var2.value)">SEARCH</a> I apologize for my ignorance, I don't really know much about javascript. When I add all that into my form page, when I submit the form, it just replaces the page I was on with the form results, rather than in the new frame page. I'm assuming I need to put the url for the frameset page in that code somewhere. Where does it go? And, which part do I replace with the frame name on that frameset page? Thank you for taking the time to help me with this, I really appreciate it! - jody

« previous php.general (#278096) next »