Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Getting Javascript to Post Data to an iFrame!?

12:51 am on May 13, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:May 7, 2008
votes: 0

So what I am trying to do is get a button to submit some data to PHP and take you to a website with PHP that is to correspond with the field you filled out. Basically a search engine. The catch is that I want the form to use javascript to interact with an iframe so when you click "GO!" I want it to not take the entire browser to a page but I want an iframe on the page to do it. Hope that made since.... Here is my current script:

<div class="titlez3"><center>Search by Name: <form method="post" action="output.php"><input type="text" name="searchname" size="30"><input type="submit" value="GO!"></form></center></div></h3>
<h3><div class="titlez4"><center>Search by Class/Period: <br /><form method="post"><input type="text" name="searchclass" size="30"><select name="classperiod"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option></select><input type="button" onClick="document.getElementById('iframe1').style.visibility='visible'; document.getElementById('iframe').src='searchclass.php'" value="GO!"></form></center></div></h3>
<h3><div class="titlez5"><center>Search by Year at CFS: <br /><form method="post"><select name="yacfs"><option value="freshmen">Freshmen</option><option value="sophomore">Sophomore</option><option value="junior">Junior</option><option value="senior">Senior</option></select><input type="button" value="GO!" onClick="document.getElementById('iframe1').style.visibility='visible'; document.getElementById('iframe').src='searchyear.php'"></form></center></div></h3>
<div id="iframe1">
<iframe height="100%" width="100%" id="iframe" name="iframe"></iframe>

Thanks in Advance!