473,810 Members | 2,948 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

href to link file

13 New Member
Hi it's my first time to post something on the net.

Hope someone can help me with this.

I just started learning how to program with php (about a month ago), so pls. bear with me. So far, i've made a simple retrieval of my database (a list of names). With each name as a LINK to display the details of that name.

Expand|Select|Wrap|Line Numbers
  1. if (mysql_num_rows($result) > 0)
  2. {
  3.   while($row = mysql_fetch_row($result))
  4.   {
  5.     echo "<a href=dummy.php>$row[1]</a>",', '.$row[2].'<br/>';
  6.   }
  7. }
  8.  
[Please enclose your code within CODE tags. Thanks! --pbmods]

I used href to set the link on. Temporarily, i'm using a dummy.php file to link to when i click a name on the list. What i really wanted to happen was to display the full detail of that name when i click on one of the names.

I understand that the table (that has all the names and their details) is already open as i am already retrieving the names. I just want to be able to click on any of the names and display it's detail. I hope I didn't sound redundant just want my case to be understood better.

Can someone pls. show me how to do that?

Thanks,

LEARNING
May 17 '07 #1
5 3772
thepresidentis
12 New Member
Have you tried registering the primary key as a variable and linking to a query for the primary key which will return only one result?
then format the result you do not need to link externally this can all be done in the same script.
May 17 '07 #2
learning
13 New Member
Hi, thanks for your thought. I really appreciate it.

I'm not quite sure if i got what you mean but i'm gonna try it out. A short sample of code would really help me understand better cause i'm still new to this.

My other concern is that ... i understand that when i click on any of the names with the link it jumps to that linked file (in my case the dummy.php file). So, how do i know which record was clicked on so I can access the details of that name (or record)?

Upon clicking on any of the names (with links), how do i capture that name and bring it to the linked file (dummy.php) so i can use it there to access the details of that particular name or record?

Again,
LEARNING
May 17 '07 #3
learning
13 New Member
Have you tried registering the primary key as a variable and linking to a query for the primary key which will return only one result?
then format the result you do not need to link externally this can all be done in the same script.
Hi again thepresidentis,

Can you pls show me how to register a primary key as a variable and how to establish a link to a query for the primary key? Do you still use the href to do that? And yes, it's better if i do it in the same script.

A short sample code that illustrates what you mean will be greatly appreciated.

Please.

Thanks,
Learning
May 17 '07 #4
code green
1,726 Recognized Expert Top Contributor
Upon clicking on any of the names (with links), how do i capture that name and bring it to the linked file (dummy.php) so i can use it there to access the details of that particular name or record?
[PHP]$name = 'anybody';
echo '<a href="address/of/your/file/dummy.php?name= $name" </a>';

dummy.php
$namehere = $_GET['name'];
echo $namehere;

//result -- anybody
[/PHP]
May 17 '07 #5
learning
13 New Member
[PHP]$name = 'anybody';
echo '<a href="address/of/your/file/dummy.php?name= $name" </a>';

dummy.php
$namehere = $_GET['name'];
echo $namehere;

//result -- anybody
[/PHP]
Hi Code Green,

Thank you so much for helping me out. Now i know how it's done with href and passing on a value to the destination link file. Now i can proceed with my php programming lessons and eventually finish my very first website.

This is my first time to join a forum. And you know what i've found out?... Forums like this one really works.

[removed --pbmods]

LEARNING
May 17 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2602
by: Sorby | last post by:
Hi I've been coding in PHP for a little while now and was starting to feel pretty confident but then realise I need to understand regular expressions to solve a particular problem I've got ... What a horrible can of worms regex is!! (to the uninitiated at least). I realise that if I spend the next few weeks researching regex I'll probably find the answer but I was wondering if anyone here would kindly help speed up the process?
14
2517
by: Brandon Hoppe | last post by:
I'm trying to change the src of an ilayer in the parent document from a link inside the ilayer. I'm not able to get it to work. All that happens is Netscape 4 crashes. This is for Netscape 4 only. For example, here is the main page: <html> <head> <script type="text/javascript">
2
9185
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display in the status bar 'Symantec Corporation' whenever anyone mouses over (onMouseOver) my image or link OR when one clicks while holding the left mouse down (onClick) on the same image or link. Upon releasing the mouse (onMouseOut), the
16
4460
by: michael | last post by:
Is it possible to get all href URLs contained in a unordered list and place them in an array? Or in fact two different arrays, differently named one for each <ul> group? <ul> <li><a href="lemurs.html">Lemurs</a></li> <li><a href="chameleons.html">Chameleons</a></li> </ul> <ul>
3
11631
by: ningjun.wang | last post by:
Hello: My html file contains the following image link: <a href="some_url"><img src="MyImage.gif"></a> How can I use Javascript to find out the value of some_url for the given image name "MyImage.gif"? I know how to get the image object with a given name (e.g.
12
3178
by: Dave Hammond | last post by:
I recently noticed the stylesheet link in an html page had the href set to a PHP script, as in: <LINK REL="stylesheet" href="some_css.php" type="text/css"> Presumably the file being referenced was actually an executable PHP script and not a css file that happened to have a .php extension. Based on that assumption, I tried the same thing with a Perl script (the webserver being tested happens to have mod_perl installed but not mod_php),...
2
5148
by: Vincent van Beveren | last post by:
Hey everyone, I've looked for this and I wouldn't know what the best practice would be for solving the following problem. We use a BASE tag in our HTML pages. Now we have some links that use the <A HREF="#" onclick="...">Hello</Amethod to invoke a JavaScript. However, because of the BASE tag, when clicking a link containing only a # as 'href' it will load the root index.html file. What I want is it to do nothing and execute the...
1
5536
by: nsvmani | last post by:
Hi, i am trying to get the FileOpen dialogue window as soon as clicked href link I am using IE6 with ActiveX enabled. Just need to get the File Open dialogue window when i click on the HREF links.It would be great , if i know how to create the dynamic HREF links like it should be getting different document based on each userid. Here is my part of jsp code for your reference: <%@ page...
2
1801
by: Mel | last post by:
I have a navigation page, very long list of urls and when you click a link it is opened in a new window. THE PROBLEM: When i scrolldown the navaigator and click on a link, it refreshes itself, even when i have target specified. How can i avoid this
10
21589
by: pt36 | last post by:
Hi I have a page with a form and a textbox. before to submit the form I want to chek if the inserted value in the textbox is already present in a database. So I need to pass the textbox value by a javascript link to another page to check. my code is <a href="javascript:location.href='page_check.php' "Go check </a> and this work and open page_check.php
0
9722
marktang
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...
0
10643
Oralloy
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...
0
10378
jinu1996
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...
1
10391
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,...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
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...
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.