Reading text as a variablle after echo

I display contents of a table using echo. Size of ecah cutomer’s table is variable. Some could be only one record and some could be hundreds. I use a code similar to the following:

<? echo $name ?>

<td width="30%" align="center" bordercolor="#C0C0C0"><font face="Arial Narrow" color="#0066cc" size="2"><? echo $soc ?></font>&nbsp;</td>

<td width="10%" align="left" bordercolor="#C0C0C0">
<p align="center"><font size="2" face="Arial Narrow" color="#FF0000"><a href=edit.php>Edit</font></a></td>

My objective is for the user to be able to click on the “Edit” link and be directed to a form to allow him/her to edit the information (Name and social security number e.g.). Is there any way to write a code which can take the displayed soc. sec. number in that particular line from the displayed text so that the information about the correct employee is displayed in the subsequent form when invoked?

Or is this a Java issue?

Thanks in advance for any help you can give.

See -

As I replied to this question there.

As ususal thank you for your help.
The link you sent however is your response to my first question which totally solved my problem. My second question which I posted is a different one. Please kindly re-read, if you would. I am displaying the info using a loop line at a time and need to be able to pick the particular data when the edit button is pushed in that particular line. Once the data is displayed in a line, how does the button know which line it is dealing with?

I hope I am making sense. Please let me know if I need to clarify further.

Thanks again.

<td width="10%" align="left" bordercolor="#C0C0C0">
<p align="center">
<font size="2" face="Arial Narrow" color="#FF0000">
<a href=edit.php>Edit</font></a></td>

That code doesn’t look too clean (especially because the font tag is deprecated, and the p tag is unclosed). Let’s refactor:

<td width="10%" align="center" bordercolor="#C0C0C0" style="font-size: 12px; font-family: Arial Narrow; color: #FF0000;">
<a href="edit.php">Edit</a></td>

Now to change the link so the edit page knows which row it should update:

<td width="10%" align="center" bordercolor="#C0C0C0" style="font-size: 12px; font-family: Arial Narrow; color: #FF0000;">
<a href="edit.php?name=<?php echo $name; ?>">Edit</a></td>

This is great. I know this is the solution to my problem but unfortunately I am not familiar with its structure. I have searched and read many many tutorials but cannot figure out what to do next. Please can someone refer me to a place or tutorial I can read on dynamic href’s or briefly explain how:



Thanks Zyppora.

Based on your reply, I just figured it out and it worked perfect. Thanks a million.


I specifically didn’t reply to your previous post because I figured the answer was basic enough for anyone to be able to find with a little bit of Google magic :wink: Besides, I’m pretty sure you feel lots better having been able to figure it out yourself rather than having the answer presented to you.

Great that you found the solution, and happy coding :slight_smile:

Good job,As ususal thank you for your help!

Sponsor our Newsletter | Privacy Policy | Terms of Service