aztec Posted March 8, 2008 Share Posted March 8, 2008 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 https://forums.phpfreaks.com/topic/95086-trouble-with-a-link/ Share on other sites More sharing options...
AndyB Posted March 8, 2008 Share Posted March 8, 2008 OK, I'm confused. Do you want a clickable link in the table cell, and forget about the form input you show, or are you trying to write the html for a clickable link into a form text input box? Link to comment https://forums.phpfreaks.com/topic/95086-trouble-with-a-link/#findComment-487069 Share on other sites More sharing options...
aztec Posted March 8, 2008 Author Share Posted March 8, 2008 Hello Sorry for the confusion. Yes I need a clickable link in a table cell. Regards Link to comment https://forums.phpfreaks.com/topic/95086-trouble-with-a-link/#findComment-487072 Share on other sites More sharing options...
MikeL Posted March 8, 2008 Share Posted March 8, 2008 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 https://forums.phpfreaks.com/topic/95086-trouble-with-a-link/#findComment-487077 Share on other sites More sharing options...
aztec Posted March 8, 2008 Author Share Posted March 8, 2008 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 https://forums.phpfreaks.com/topic/95086-trouble-with-a-link/#findComment-487091 Share on other sites More sharing options...
AndyB Posted March 8, 2008 Share Posted March 8, 2008 <td colspan="4" class="fieldcellmed"><a href='<?php echo $name;?>.php'><?php echo $name;?></a></td> Link to comment https://forums.phpfreaks.com/topic/95086-trouble-with-a-link/#findComment-487107 Share on other sites More sharing options...
aztec Posted March 8, 2008 Author Share Posted March 8, 2008 Hello Thanks a lot, the topic is solved but the solved link is missing Regards Link to comment https://forums.phpfreaks.com/topic/95086-trouble-with-a-link/#findComment-487116 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.