473,321 Members | 1,667 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,321 software developers and data experts.

Create a dynamic hyperlink inside a cell and send variable to another page

Hi
I have the following piece aof code

Expand|Select|Wrap|Line Numbers
  1.        while($row = mysql_fetch_array($event))
  2.         {
  3.           echo "<tr>";
  4.           echo "<td>" . $row['surnameNM'] . "</td>";
  5.           $str_id = $row['personID'];
  6.           echo "<td>" . $row['nameNM'] . "</td>";
  7. echo "<td>" . $row['personID'] . "</td>";
  8.           echo "</tr>";
  9.         }
  10.         mysql_close($getSurname);
I would like to create an hyperlink for each row on the NameNM field and send the corresponding personID within the hyperlink, something like getPerson.php?Identity=$str_id.

I have tried several options and none works. Please keep in mind it must be inside the "<td>" cell.

Thank you in advance
Feb 14 '13 #1
6 1730
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

There's no hyperlink in your code.
Feb 14 '13 #2
Exactly. I know how to do it in asp but not in PHP. I have tried several options but none works.
Feb 15 '13 #3
Rabbit
12,516 Expert Mod 8TB
You would have to show us one of the options you've tried before I can tell you where you went wrong.
Feb 15 '13 #4
Here it goes
<a href="getPerson.php?identity=$str_id">Link to Page</a>
How do I place this inside
echo "<td>" . $row['nameNM'] . "</td>";
The variable $str_id is the personID of the nameNM I want.
Feb 15 '13 #5
Rabbit
12,516 Expert Mod 8TB
You can echo it like it is, you'll just need to escape the double quotes.
Feb 16 '13 #6
I am a complete newbie on PHP
Nevertheless i wrote
echo "<td><a href=getPerson.php?identity=$str_id>".$row['nameNM']."</a></td>";
and it works.
Thank you for your didactical patience.
Feb 16 '13 #7

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

Similar topics

2
by: Rob Rogers | last post by:
I am old programmer, but this asp.net stuff throws me for a loop. I have an asp.net page that I need to create a dynamic hyperlink from based on the user selection from the drop down list and...
0
by: Mo | last post by:
On one webpage I have a datagrid which is filled when the user selects some search criteria (e.g. surname or DoB) in different text fields and clicks on a button control. The datagrid also...
1
by: Mundungus Fletcher | last post by:
Greetings, I apologize if this has been asked and answered a lot. Googling showed me a few people asking, but I didn't find any clear-cut answers. I have a vendor db, and I need to create a...
4
by: UJ | last post by:
I'm a newbie to this so please excuse the level of question. My question is how can I dynamically create a table in the middle of a page without having to build the entire page dynamically? I have...
3
by: sloesch | last post by:
I am working with VS.net 2003, framework 1.1, developing with VB.net, and ASP.net, and I would like to know how you can create a dynamic hyperlink on the fly to a document stored in a SQL database?...
1
by: sweetpotatop | last post by:
Hello, I would like to create dynamic hyperlinks in a web page when it is first loaded by using ASP.NET. Basically there will be a list of documents in a folder and I will list them all as a...
17
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the...
0
by: Bryan Ax | last post by:
I'm trying to fix a bug in someone else's code. He's got a string saved in a database such as: <xsl:variable name="Var1"> <xsl:choose> <xsl:when test="@SomeAttribute &gt; 1'"> <xsl:value-of...
1
by: fiefie.niles | last post by:
I am using .NET Framework 1.1 and VB.NET for the language. I would like to create a table where the first column texts are hyperlinks so that I can click on it to go to another page. How can I do...
8
by: remya1000 | last post by:
i'm using VB \ ASP.NET. i'm trying to display some values in Gridview. but i don't know how many columns i need to display. at run time only i will come to know how many columns i need to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.