ghjk 250
Contributor
In my php page there is a search function and when user search it will display table containing search results. I want to add
. Because when user click one record I want to pass values to ajax page.
to those results. But my code is not working. Please help me.This is my code. -
while($row = mysql_fetch_array($result))
-
{
-
echo "<a href='javascript:void(0);' onclick=\"LookupVehicle('$VehicleNo','$VehicleType','$VehicleMake','$Price'); return false;\">";
-
$array = array('VehicleNo','VehicleType','VehicleMake','Price');
-
foreach ($array as $v)
-
$$v = $row[$v];?>
-
-
<tr>
-
<?php
-
-
foreach ($array as $v)
-
echo "<td height=20 cursor: pointer;'> ".$$v."</td>";
-
?>
-
</a>
-
</tr>
-
-
<?php }
-
1 4957 Atli 5,058
Recognized Expert Expert
Hey.
Not feeling particularly articulate today, so I just commented your code :-] - <?php
-
while($row = mysql_fetch_array($result))
-
{
-
// Isn't this supposed to be *after* you crate the variables you are echoing?
-
// And why is the ending </a> somewhere way inside the <tr> tag?
-
echo "<a href='javascript:void(0);' onclick=\"LookupVehicle('$VehicleNo','$VehicleType','$VehicleMake','$Price'); return false;\">";
-
-
// Why bother with this? You can just as easilly use
-
// "$row['VehicleNo']" as "$VehicleNo"
-
$array = array('VehicleNo','VehicleType','VehicleMake','Price');
-
foreach ($array as $v){
-
$$v = $row[$v];
-
}
-
// P.S. Note the addition of the brackets to your foreach loop.
-
// Always use brackets. Leaving them out is just sloppy.
-
-
// No poing exiting the <?php block just to output 4 letters.
-
// Echo was created for a reason ;-)
-
echo "<tr>";
-
-
foreach ($array as $v) {
-
echo "<td height=20 cursor: pointer;'> ".$$v."</td>";
-
}
-
// Again, note the added brackets to the loop.
-
-
// 9 letters this time. Still not worth exiting the PHP block ;-)
-
// What's with the random </a> here? Shouldn't it be up there with the
-
// rest of the <a> tag?
-
// Unless you are trying to make the entire row a link, in which case
-
// you should use the <tr> onclick event, not enclose the <tr> in a <a> tag.
-
echo "</a></tr>";
-
}
-
?>
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Nel |
last post by:
Hi all,
I have been searching for some clues as to how to show a substring from a
database search.
$pagetitle = "Page Title";
$pagetext = "This is <b>a typical</b> string that would be stored<br>in the
database.";
|
by: CharitiesOnline |
last post by:
Hello,
I have set this script up to add paging to a search results page. Which on
the first page works fine. I calculates how many pages there should be
depending on the number of results returned from my search and how many
records I have set it to display per page. All great so far, HOWEVER.....
When you click the next link to see the next 10 results on the next page, it
just dumps the search details and pulls up all the records in the...
|
by: George |
last post by:
Hi,
Anyone has the background for explaining?
I have made a search on my name and I have got a link to another
search engine.
The link's title was the search phrase for the other search engine (a
wicked phrase). Some but not all of the words of that phrase exist in
my website.
I reported it and they removed the link but did not give explanations.
|
by: Dica |
last post by:
i apologize for what is no doubt a very rudimentary question, but i'm still
trying to wrap my brain around .net coding habits. in classic asp, if i
wanted to show search results, i'd just post the form data over to another
page or call a showSearchResults sub on the search page. in .net, i can't
post to another page, so i need to show the search results on the same page
as the search form page. i could write a sub in my code behind that...
|
by: sqlster |
last post by:
I have a search page which renders results upon post back based on certain
input criteria. Clicking on a link on a search result such as order number
navigates to the order detail screen.
What is the best away to program behind the "Back to search results" screen
on order detail screen. Should I session stored the input criteria on search
page so that when it is invoked from order detail screen, it would pull out
that information and...
| |
by: =?Utf-8?B?Qm9ubmll?= |
last post by:
I have a basic ASP / Index Server search page. I have a web site contained in
a subdirectory in the root of a main web site. What I’m trying to do is force
the search page in the subdirectory, conduct its search ONLY in the
subdirectory, and NOT display results from the parent/root. (Note: there is
also a similar search page for the main site, in the root, which I am having
no problem excluding the subdirectory from its search results.)
...
|
by: bendlam |
last post by:
I have a page that contains search criteria and when you click on the
search button it causes a post back that populates a dataview on the
same page. One of the gridview columns contains a link that navigates
to a details page. When I try to go back to the search results page i
get "Page cannot be displayed" error. How do i go back to the search
results and have the search criteria and dataview unchanged?
i.e. The behaviour I'm...
|
by: Bigalan |
last post by:
Hello, i am relatively new to PHP and i am struggling with printing multiple search results on to different pages. The code below works ok but when you click on next page button, it brings up a blank screen. I think it might have something to do with resetting the $found variable. Can you have a quick look? any suggestions would be greatly appreciated.
<?
if ($_GET) $vars=$_GET;
else $vars=$_POST;
$found = $vars;
|
by: moorcroft |
last post by:
Hi I have developed an application that people can use to search for planning applications. The way it works is that once search criteria has been selected and submit is hit, the server will save the search results in an xml file and then redirect to the view search results screen. This screen checks if the xml file exists and if it does, it displays the results, otherwise it says results have expired.
The problem is the fact that this is...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |