Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here





I want to load an IFRAME element with an SQL query but how do I write the SRC attribute? What I've done is point the SRC to foo.php3 file which in turn runs the SQL statement and echoes back the result. I'm fairly new to PHP and MySQL so I suspect there is a more elegant way to do this.

Someone please enlighten me,

Robert Bell


Not sure exactly what you want to do, but my guess is you want to have a form in the parent window where users can enter their search requests, and then you want the results to load in the IRAME window. I haven't done this before, but it should be quite simple: you need to create a PHP page that accepts parameters as it loads, and then executes a query based on those parameters. The easiest way to pass along parameters is in the URL itself.
Your main page could be "search.php3" with a form that simply submits a redirect to hyperlink to "results.php3" pointing to the IFRAME. In the URL of the link that the Submit button points to, you will use something like "results.php3?term1=1st_variable&?term2=2nd_varable" For an example of a site that uses this approach, go to www.php.net; when your mouse hovers over the Quick Ref button, it brings up a layer that lets you enter a search for terms; when you submit your search, it goes to a URL like "http://www.php.net/search.php3?pattern=term&show=nosource";

As you can see, it is passing along two variables to the search.php3 page so that the page can do a query on them.

I hope this helps; I'm sure there are more ways to do this. Anyone?


Got it worked out and then the design changed so I didn't need the iframe solution. Definitely put it in the bag of tricks though.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close