Hi there,

I am facing problem in coding PHP for my search results, my search results produce dynamic URLs (clickable texts) but when i click on the url's no results.
In my website am trying to display all hotels in a city, and Iam searching with the hotel name and location. The search result displays resullts in a list (hotel name and location) and are clickable. when i click on the links a new page should open showing details of the hotel such as name, location, address, phone number etc.

please help me with the code as am a php no voice.

Recommended Answers

All 10 Replies

Member Avatar for diafol

please help me with the code as am a php no voice.

What code? You haven't posted any. Show your code.

Please complete your details so that we can know what specific problem that you having for.

this is my code, table name is table1, the results(links) are being displayed on my home page, but when i click on the links details are not being displayed, please help!

<?php
include ('connectdb.php');
$query = "SELECT type, name, location, landmark FROM table1";
$result = @mysql_query($query);
echo mysql_error();

if ($result) {
while($arr = mysql_fetch_array($result, MYSQL_ASSOC)){
$resultlink = "\n\t<li><a href=\"posts.php?ID={$arr['id']}+{$arr['type']}+{$arr['name']}\">{$arr['name']} {$arr['location']}</a></li>";
            $end_result    .= '<li>' . $resultlink . '</li>';


$resultlink  .=     "
    \n<p>Name: {$arr['name']}</p>
    \n<p>Type: {$arr['type']}</p>
    \n<p>Location: {$arr['location']}</p>";
        }

        echo $end_result;
    }  else {
        echo "<p>Sorry no results for $word</p>";
        }

?>

well all i can see so far is that when you click on the link, you get a url that only has 1 variable.

post.php?id=1hoteljoes

try

<a href=\"post.php?id=".$arr['id']."&type=".$arr['type']."&name=".$arr['name']."\">

Hi fobos,
that works fine, my question was when I click on the URL no result is being displayed.
please help me in that way.

well then you need to post the code for the other page. why post a code if you didnt have a problem with it

do any values show up in the URL when you hover over it?

When I click on the page also only the link is displayed in the resulting page.

any body there to help me...??

the dynamic links are displayed correctly but when i click on a link all the links are displayed instead of the row data of that particular link(id). please help me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.