gple Posted November 20, 2006 Share Posted November 20, 2006 I am using a table with data in it to help create a list of links using php.for ($i=0;$i<$num;$i++){$team=($result,$i,"team")//this line gets the team name. // if I echo $team out, i will get Holy Crossecho "<a href=team_schedule.php?$team=".$team.">".$team."</a>";//This code is supposed to produce a link that reads <a href=team_schedule.php?team=holy cross> but for some reason this only produces <a href=team_schedule.php?team=holy. It doesnt recognize anything after the space. Any ideas why this happens and what can be done to make this work. This only happens when the team I am pulling from the table has two words with a space. The info cannot be altered. Any ideas?} Link to comment https://forums.phpfreaks.com/topic/27870-problem-with-a-list/ Share on other sites More sharing options...
glenelkins Posted November 20, 2006 Share Posted November 20, 2006 echo "<a href=team_schedule.php?$team=".$team.">".$team."[/url]"; <--- WHAT?? tryecho "<a href='team_schedule.php?team=" . $team . "'>" . $team . "</a>"; Link to comment https://forums.phpfreaks.com/topic/27870-problem-with-a-list/#findComment-127437 Share on other sites More sharing options...
gple Posted November 20, 2006 Author Share Posted November 20, 2006 This still does not work. Link to comment https://forums.phpfreaks.com/topic/27870-problem-with-a-list/#findComment-127444 Share on other sites More sharing options...
craygo Posted November 20, 2006 Share Posted November 20, 2006 [/url] is not a html code. Try this[code]echo "<a href='team_schedule.php?team=".$team."'>".$team."</a>";[/code]Ray Link to comment https://forums.phpfreaks.com/topic/27870-problem-with-a-list/#findComment-127446 Share on other sites More sharing options...
gple Posted November 20, 2006 Author Share Posted November 20, 2006 Im not typing [/Url], for some reason the forum is changing </a> to [/URL]. I have </a> in the code and still doesnt work. Link to comment https://forums.phpfreaks.com/topic/27870-problem-with-a-list/#findComment-127449 Share on other sites More sharing options...
glenelkins Posted November 20, 2006 Share Posted November 20, 2006 hii dont know why it put [/URL] at the end i did not put that[code]echo "<a href='team_schedule.php?team=" . $team . "'>" . $team . "</a>";[/code] Link to comment https://forums.phpfreaks.com/topic/27870-problem-with-a-list/#findComment-127451 Share on other sites More sharing options...
kenrbnsn Posted November 20, 2006 Share Posted November 20, 2006 The forum code put the [nobbc][/url][/nobbc] into your code because it saw what it thought was a URL. To avoid this in the future, please surround all of your code with [b][nobbc][code][/code][/nobbc][/b] tags. As for your problem, you need to enclose the value of the href attribute of the HTML address tag [nobbc]<a>[/nobbc] in quotes. This will make sure that all spaces are included in the value of the URL.[code]<?phpecho '<a href="team_schedule.php?team=' . $team . '">' . $team;?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/27870-problem-with-a-list/#findComment-127462 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.