473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

href to link file

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 3732
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
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
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 Expert 1GB
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
[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
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 ......
14
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....
2
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...
16
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...
3
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...
12
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...
2
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...
1
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...
2
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...
10
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.