Jump to content

Trouble with a Link


aztec

Recommended Posts

Hello

 

I am having a problem with putting a link into a table cell, the table is formatted using an external css file. The following is the code for the table row

 

<td colspan="4" class="fieldcellmed"> <input type="text"  id="name" value = "<?php echo $name; ?>"</td>

 

This code will put the name which is contained in $name into the cell. ie value =  value = "<?php echo $name; ?>"</td>

 

What I need in the cell is the result of the following:

 

<a href=<?php echo $name; ?>.php ><?php echo $name; ?></a>

 

Which should be a clickable link.

 

When I enter the code directly after the "value =" it does not create a link but enters part of the code into the cell and part outside the cell.

 

I have searched the board and also the web but most of the web results use Javascript which I do not want to use, any help or advice would be appreciated.

 

Kind Regards

 

Link to comment
Share on other sites

ok um... I'm having a hard time figuring out what you're asking. But, I'll give it a shot.

 

<a href="<?=$name?>.php<?=$name?>">mylink</a>

 

if $name where "mike" that would yield

 

<a href="mike.phpmike">mylink</a>

 

which doesn't really make a lot of sense

are you trying to pass name as a GET value in the url?

if so that would be

 

<a href="<?=$name?>.php?name=<?=$name?>">mylink</a>

 

which would yield

<a href="mike.php?name=mike">mylink</a>

 

the receiving php script would access the name value through the super global

$_GET['name']

 

and

<?=$name?>

is just shorthand for

<?php echo $name; ?>

 

do that answer your question?

Link to comment
Share on other sites

Hello

 

Thanks MikeL for trying to help, I have tried your code and it does not solve the problem I have.  The following code produces a clickable link:

<a href=<?php echo $name; ?>.php ><?php echo $name; ?></a>

 

If $name contains Laura then the result is:

 

<a href=Laura.php >Laura</a>

 

The system is placing [/url] on the end of the link.

 

My problem is to get it into a table cell.

 

Regards

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.