saversites Posted December 19, 2017 Report Posted December 19, 2017 Folks, I'm creating like a meta engine where you choose which searchengine to use. I'll get to the point where my site will show you search results that have links from all searchengine results. But as for now, let's take things one step at a time. OFF TOPIC: Oh man! Shut the F* Up! (I got a lousy fox howling at the back of my backyard near the woods!). It shut the hell up once I wrote this. maybe, I'm becoming psychic some-how getting my message across to creepy things! Lol! TOPIC: For now, I'm giving user the option to choose which searchengine to use. Right now, I've managed to program where the search results (from your chosen searchengine) is shown on the current window. I want it to show in a new window. So, how to code that part ? I've googled and checked Stack Over Flow and I see a lot of others are searching for the same code but no one is having any luck! Here's my code for now: <?php /* ERROR HANDLING */ declare(strict_types=1); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); //Step 2: Check user submitted details. //2A. Check whether user made all the required inputs or not. if (isset($_POST["keywords"]) && isset($_POST["searchengine"])) { //2B. Create variables based on user inputs. $keywords = trim($_POST['keywords']); $searchengine = trim($_POST['searchengine']); if (strlen($searchengine) < 1) { $searchengine = 'mysearchengine'; } elseif ($searchengine = 'google') { $serp = "https://www.google.com/search?q=$keywords"; header("location: $serp"); } elseif ($searchengine = 'yahoo') { $serp = "https://search.yahoo.com/search?p=$keywords"; header("location: $serp"); } elseif ($searchengine = 'msn') { $serp = "https://www.bing.com/search?q=$keywords"; header("location: $serp"); } echo "$searchengine"; echo "$keywords"; } } ?> <!DOCTYPE html> <html> <head> <title><?php $site_name ?>Meta Searcher</title> <meta charset="utf-8"> </head> <body> <form method="post" action=""> <p align="left"><h2>Meta Searcher</h2></p> <fieldset> <label for="keywords_search">Search Keywords:</label> <input type="text" name="keywords" id="kw" value="" placeholder="Keywords"><br> <label for="searchengine">Searchengine:</label> <input type="radio" name="searchengine" value="mysearchengine" <?php if(isset($_POST['mysearchengine'])) { echo 'checked'; }?> required>My Searchengine <input type="radio" name="searchengine" value="google" <?php if(isset($_POST['google'])) { echo 'checked'; }?> required>Google <input type="radio" name="searchengine" value="yahoo" <?php if(isset($_POST['yahoo'])) { echo 'checked'; }?> required>Yahoo <input type="radio" name="searchengine" value="msn" <?php if(isset($_POST['msn'])) { echo 'checked'; }?> required>Msn </fieldset> <div class="SubmitsAndHiddens"> <input type="hidden" name="meta_searcher" id="meta_searcher" /> <br> <button type="submit">Search!</button> <br> </div> </form> </body> </html> Quote
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.
Note: Your post will require moderator approval before it will be visible.