Chris88 Posted August 17, 2006 Share Posted August 17, 2006 Hello, the code below is a simple search page that allows me to search on imdb.com and google images in one go, but I have a few small problems with it.1) The code only works when the "Search" button is clicked, but doesn't work when the "Enter" key is pressed.2) The searching only seems to work with Internet Explorer, but not with FireFox. With FireFox only the first frame is visible, but not the imdb website.3) I'd like to have a small gap between the two frames, but it doesn't work no matter where I put <.br> in the code.Is there anybody here who can help me with that?Thank you.[code]<html> <head> <title> Search Page </title> </head> <body bgcolor="#003399"> <center> <form action="<?php echo($PHP_SELF); ?>" method="POST"> <font color="#FFFFFF"><strong>Movie Search:</strong></font> <input type="text" name="queryORIGINAL"> <input type="submit" value="Search" name="submit"> </form> <?php $submit = $_POST['submit']; If ($submit) { $queryORIGINAL = $_POST['queryORIGINAL']; str_replace(" ", "+", $queryORIGINAL); echo "<iframe src=\"http://www.imdb.com/find?q=$queryORIGINAL&l;tt=on;nm=on;mx=20\" width=\"90%\" height=\"90%\">"; } ?> <?php $submit = $_POST['submit']; If ($submit) { $queryORIGINAL = $_POST['queryORIGINAL']; str_replace(" ", "+", $queryORIGINAL); echo "<iframe src=\"http://images.google.com/images?svnum=100&hl=en&lr=&imgsz=small%7Cmedium%7Clarge%7Cxlarge&safe=off&q=$queryORIGINAL+poster\" width=\"90%\" height=\"90%\">"; } ?> </center> </body> </html>[/code] Quote Link to comment Share on other sites More sharing options...
craygo Posted August 17, 2006 Share Posted August 17, 2006 Hey, ok found out a couple things1. Not sure why the enter key won't work. will get back to this one.2. You forgot to close the iframe tags. Internet explorer is ALOT more lenient in this respect3. Once you clode the tags you can add a space.Some of the code you repeated so I cut it down a bit. Up to you if you want to use it[code]<html><head> <title> Search Page </title> </head><body bgcolor="#003399"><center><?if(isset($_POST['submit'])){?><form name=form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> <font color="#FFFFFF"><strong>Movie Search:</strong></font> <input type="text" name="queryORIGINAL"><input type="submit" value="Search" name="submit"></form><? $submit = $_POST['submit']; $queryORIGINAL = $_POST['queryORIGINAL']; str_replace(" ", "+", $queryORIGINAL); echo "<iframe src=\"http://www.imdb.com/find?q=$queryORIGINAL&l;tt=on;nm=on;mx=20\" width=\"90%\" height=\"90%\"></iframe>"; echo "<hr>"; echo "<iframe src=\"http://images.google.com/images?svnum=100&hl=en&lr=&imgsz=small%7Cmedium%7Clarge%7Cxlarge&safe=off&q=$queryORIGINAL+poster\" width=\"90%\" height=\"90%\"></iframe>";} else {?><form name=form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> <font color="#FFFFFF"><strong>Movie Search:</strong></font> <input type="text" name="queryORIGINAL"> <input type="submit" value="Search" name="submit"></form><?php}?></center></body></html>[/code]Ray Quote Link to comment Share on other sites More sharing options...
Chris88 Posted August 18, 2006 Author Share Posted August 18, 2006 Thank you very much, craygo.One more question. Is it possible to use a search string with the search page, like imdb.com?If you put the following url in the address bar of your browser, then it searches for "matrix" right away when the page loads.http://www.imdb.com/find?q=matrix&l;tt=on;nm=on;mx=20I'm wondering if I can do this with my search page as well, for example: http://mywebsite/search.php?q=matrix Quote Link to comment Share on other sites More sharing options...
Jocka Posted August 18, 2006 Share Posted August 18, 2006 Yea. just use "$_GET" instead of "$_POST" and change the form method to "GET" Quote Link to comment Share on other sites More sharing options...
Chris88 Posted August 18, 2006 Author Share Posted August 18, 2006 Thank you Jocka :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.