I get that but what i don't get is why they don't have a value. If they didn't then i wouldn't be seeing my results in the first place?
Main Topics
Browse All TopicsHi all,
I am having a problem with a php page im working on.
The page is a results page from a keyword search page.
On this page i limit the records to 10 and have page numbers so the user can click on the page they want records for.
I also have a script at the top of the page that directs the user back to the search form and echos a message if no fields are filled in and the search is submitted.
The problem i have is if i click one of the page numbers to view records on that recordset page, the page doesnt load, instead the header code at the top of my page is executed. and i get redirected to the search form as if i just entered a blank search?
I assume this is due to the way i have my code laid out but i am unsure how to fix the issue while retaining my header script at the top of the page.
Here is my entire page code so you can see what i am reffering to.
<?php require_once('Connections/
<?php
$keyword_street = "";
$keyword_village = "";
$case = 0;
if(!isset($_REQUEST["keywo
{
$keyword_street = "<font color=\"red\">Please enter this field!</font>";
}
if(!isset($_REQUEST["keywo
{
$keyword_village = "<font color=\"red\">Please enter this field!</font>";
}
if($keyword_village!="" && $keyword_street!="")
{
header("Location: keyword2.php?street=$keywo
// Keyword2.php is the name of the page where my search form is.
exit();
}
?>
<?
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Reco
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_
$keywordstreet = $_REQUEST['keyword_street'
$keywordvillage = $_REQUEST['keyword_village
$K_street = $_POST['keyword_street'];
$K_village = $_POST['keyword_village'];
if (strlen($_POST['keyword_st
$test = "one";
}
if (strlen($_POST['keyword_vi
$test2 = "two";
}
if ($test = "one" && $test2 = "two") {
$where_clause = "WHERE property_address1 LIKE '%$keywordstreet%' AND property_towncity LIKE '%$keywordvillage%'";
}
$query_Recordset1 = "SELECT * FROM properties $where_clause ORDER BY price ASC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_R
$row_Recordset1 = mysql_fetch_assoc($Records
$totalRows_Recordset1 = mysql_num_rows($Recordset1
if (isset($_GET['totalRows_Re
$totalRows_Recordset1 = $_GET['totalRows_Recordset
} else {
$all_Recordset1 = mysql_query($query_Records
$totalRows_Recordset1 = mysql_num_rows($all_Record
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1
if ($totalRows_Recordset1 == 0){
echo "There are no results matching your search criteria <BR> Keyword 1:$K_street <BR> Keyword 2:$K_village <BR><BR> Click Here to search again!";
}
echo "whereclause:$where_clause
echo "keyword Street: $keywordstreet<br>";
echo "keyword Village: $keywordvillage<br>";
echo "test: $test<br>";
echo "test2: $test2<br>";
do {
?>
<p><?php echo $row_Recordset1['property_
<p><?php echo $row_Recordset1['property_
<p><?php echo $row_Recordset1['property_
<p><?php echo $row_Recordset1['property_
<p><?php echo $row_Recordset1['prop_post
<p><?php echo $row_Recordset1['pic1']; ?></p>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Records
Page <?php for ($i = 0; $i <= $totalPages_Recordset1; $i++) {
$href = sprintf('%s?pageNum_Record
$label = $i + 1;
echo '<a href="'.$href.'">'.$label.
}
?>
<?php
mysql_free_result($Records
?>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
try this
if(!isset($_GET['pageNum_R
if(!isset($_REQUEST["keywo
{
$keyword_street = "<font color=\"red\">Please enter this field!</font>";
}
if(!isset($_REQUEST["keywo
{
$keyword_village = "<font color=\"red\">Please enter this field!</font>";
}
if($keyword_village!="" && $keyword_street!="")
{
header("Location: keyword2.php?street=$keywo
// Keyword2.php is the name of the page where my search form is.
exit();
}
}
forgot a ) .. sorry
if(!isset($_GET['pageNum_R
if(!isset($_REQUEST["keywo
{
$keyword_street = "<font color=\"red\">Please enter this field!</font>";
}
if(!isset($_REQUEST["keywo
{
$keyword_village = "<font color=\"red\">Please enter this field!</font>";
}
if($keyword_village!="" && $keyword_street!="")
{
header("Location: keyword2.php?street=$keywo
// Keyword2.php is the name of the page where my search form is.
exit();
}
}
Ok cool cheers, The search works again and when i click the numbers it doesnt revert to the search page. but now when i click the page numbers the results screw up and show all in the table rather than the results based on my search? Example the results were 2 pages of records. I click page 2 and then the results display all records. So the search results are lost.
any ideas?
try this
$keywordstreet = $_REQUEST['keyword_street'
$keywordvillage = $_REQUEST['keyword_village
$K_street = $_POST['keyword_street'];
$K_village = $_POST['keyword_village'];
$queryString_Recordset1 = "&keyword_street=".$_REQUE
if ($keywordstreet) {
$test = "one";
}
if ($keywordvillage) {
$test2 = "two";
}
just wish i knew how you did that! it works!
Many thanks
i want to do something similar to the header script for when a user searches something thats not found.
at the moment i got this line:
if ($totalRows_Recordset1 == 0){
echo "There are no results matching your search criteria <BR> Keyword 1:$K_street <BR> Keyword 2:$K_village <BR><BR> Click Here to search again!";
}
Do you know if its possible to treat this the same as when a user trys to submit no data?
$queryString_Recordset1 = "&keyword_street=".$_REQUE
That just passes the search criteria to the next page.
>> Do you know if its possible to treat this the same as when a user trys to submit no data?
You mean redirect the user back to the search page ?
yes in essence what i want is the user to get a message on the searchform.php page saying no results found. like i have for when the form is submitted with no data.
Or instead of my code :
echo "There are no results matching your search criteria <BR> Keyword 1:$K_street <BR> Keyword 2:$K_village <BR><BR> Click Here to search again!";
}
have the user directed to a new page where i can state no results were found.
Congratulations!!!
http://www.experts-exchang
>>i havent a clue what type it is?
from the EE newsletter
"Each laptop is outfitted with an Intel Core 2 Duo 2.0GHz processor, a 17-inch wide screen display, 2GB of memory, and dual 120GB hard drives. Our superb designers mocked up some flashy desktop wallpapers for the winners new laptops....."
congrats satmanuk!!
kiranvj
Business Accounts
Answer for Membership
by: hieloPosted on 2007-11-13 at 15:19:41ID: 20276265
These: rd_street" ]) || $_REQUEST["keyword_street" ]=='')
rd_village "]) || $_REQUEST["keyword_village "]=='')
if(!isset($_REQUEST["keywo
{
$keyword_street = "<font color=\"red\">Please enter this field!</font>";
}
if(!isset($_REQUEST["keywo
{
$keyword_village = "<font color=\"red\">Please enter this field!</font>";
}
make sure that $keyword_village and $keyword_street always contain some value. Thus,
if($keyword_village!="" && $keyword_street!="")
will always be true an the header function will execute