Jump to content

[SOLVED] loads in wrong page


contra10

Recommended Posts

I'm trying to create a search bar thats when a person enters a variable it redirects them to the results page, when a person searches the first time its of but then when on the results page and a person searches then the result is an iframe with the information inside of it, and no redirect in browser.

 

my coding

 

<?php

$find = $_POST['input'];

// We preform a bit of filtering 
$find = strtoupper($find); 
$find = strip_tags($find); 
$find = trim ($find); 

if(isset($_POST['submit'])){

header("Location: http://www.test.com/add/search.php?pagenum=1&search=$find"); 

}
?>
<form name="search" method="post" action="<?=$PHP_SELF?>">
Seach for: <input type="text" name="input" />
<input type="hidden" name="searching" value="yes" />
<input type="submit" name="submit" value="Search" />
</form>

 

and the results page

TEST Results

<iframe src="http://www.test.ca/add/searchfor.php" scrolling="no" frameborder="0"> </iframe>
<table border="0" width="900" valign="top">
<tr><td><h3>SEARCH RESULTS</h3></td></tr>
</table>
<table border="0" width="900" valign="top" height="500">
<?php
// Connects to your Database 
mysql_connect("localhost", "", "") or die(mysql_error()); 
mysql_select_db("deals") or die(mysql_error()); 

//This checks to see if there is a page number. If not, it will set it to page 1 
$pagenum = $_GET['pagenum'];

if ($pagenum) 
{ 
}
else{
$pagenum = 1;  
} 

$sr = $_GET['search'];
if($sr){
//Here we count the number of results 
$querye = "SELECT * FROM `deal` WHERE `title` LIKE '%$sr%' and `release`='yes'";
$result = mysql_query($querye) or die(mysql_error());
$rows= mysql_num_rows($result);
?>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.