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
https://forums.phpfreaks.com/topic/168574-solved-loads-in-wrong-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.