I am a beginner in php.. For the sake of experiment with that , I would like to create a page that contains a search box where a user can enter the search tearm and that query will be fed to google (of the form "http://www.google.co.in/search?q=") and the resulting page will be displayed below my search box in my page (ie. a dynamic frame in my page that will display the corresponding pages - as such - from Google). Can any one help me? PS: I don't mind in using seperate html templete files for these
I'm not sure if this will work (I haven't used iframes in a long time). echo("<form method='POST'>"); echo("<p><input type='text' name='search_var' value='Search terms...' /><input type='submit' name='search' value='Search' /></p>"); echo("</form>"); if(isset($_POST['search']) && !empty($_POST['search_var'])) { $search = $_POST['search_var']; echo("<p>You searched for ".$search.". Results below.</p>"); echo("<iframe src='http://www.google.co.in/search?q=".$search."'>Some text in case the iframe cannot be display.</iframe>"); } PHP:
Umm...that should work, you need a HTML form to go with it: <form method="post" action="file.php"> <input type="hidden" name="search"/> <input type="text" name="search_var"/> <input type="submit" value="Search" /> </form> Code (markup):