Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2010
    Thanked 0 Times in 0 Posts

    Question top webpage search box help

    all files are php .... Website with the search box in the main site and the search engine is in iframe

    This is the code for the top of the website search box

    <input name="search" class="search" type="text" value="under construction..." onfocus="if(this.value == 'under construction...'){this.value = '';}"/>

    The search engine is on the website in iframe


    <p><iframe src ="http://testsite2.comze.com/test/search" width="100%" height="580" frameBorder="0">
    <p>Your browser does not support iframes.</p>

    The form code in the search/index.php for the iframe

    <form action='index.php' method='get'>
    <center><h2>Search</h2><br />

    <input type='text' name='query' size='50' value='<?php echo $query; ?>' />
    <br />
    <input type='submit' value='Search!' />

    How can i get to where someone types in the top search box and the results show in the results page from the search engine in iframe


  • #2
    Regular Coder xconspirisist's Avatar
    Join Date
    Jun 2006
    Great Britain.
    Thanked 6 Times in 6 Posts
    You can do it by not using iframes? This is a javascript question, not a PHP one. Here goes;

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    		<script type = "text/javascript">
    			function submitThing() {
    				q = document.getElementById('query')
    				iframe = document.getElementById('myiframe');
    				iframe.src = 'http://example.com?q=' + q.value;
    <input id = "query" />
    <input type = "submit" onclick = "submitThing()" />
    <iframe src = "http://google.com" id = "myiframe">
    Demonstration of code available here; http://tydus.net/tst/192712.php
    If I have been helpful, use the "thank" button - It makes me happy!

    xconspirisist.co.uk - homepage of my online alias
    technowax.net - a community for people interested in all forms of modern technology.

  • #3
    New to the CF scene
    Join Date
    Mar 2010
    Thanked 0 Times in 0 Posts
    This is the main site

    This is the Iframe site

    If u click on Business Directory u'll see the Iframe site in the middle of the main site so how can i use ur code ... to different sites but trying to get the top serach box after submit show up in the iframe search page ... and if you type in "ho" in the search u'll get hollywood as the result from the iframe site. and the search box from the main site u get nothing to the iframe site.
    Last edited by demonic5150; 03-31-2010 at 02:15 AM.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts