Jump to content

Help with the linking in a dynamic menu


Fallen_angel

Recommended Posts

I am getting a bit oif a strange thing happening and I am not sure why so I am hopign some people can help

What this script does is that it maintains a dynamic menu list of the all the authors names,  when they click the name they get a list of the books or white papers available, the list park works great as does the finding function once the ID variable is set right , which is where i am having an issue

When I pull  information from my database to just be echo'ed onto a normal page the output comes out as expected ( if there are two words it comes out with two ect)

On the other hand though as you can see from the bellow script I am trying to use one of my variables in a url $info['name'] when I do this however only the first word of the database field is echoed the seccond is ignored

so instead of my page being linked to ?id=Image1 Name (?id=Image1%20Name)  it is just getting to the space and then dying so all I get is ?id=Image1  which isn't goign to find what I need it to when somone clicks on the link

If somone could please have a look at my bellow script and tell me where i am goign wrong or what i'm missing I would really apreciate it

[code]<?php
//Connect To database
include "connect.php";
$id = $_GET['id'];
//collects Data
$data=mysql_query("SELECT b_id,b_name FROM database ORDER by 'b_name'")
or die(mysql_error());
$name=$info['b_name'];

Print "<table class='print_list_alpha' >" ;
while ($info= mysql_fetch_array($data) )
{
Print "<a href=./sort.php?id=".$info['b_name'].">".$info['b_name']."</a> <br>" ;
}
?>[/code]



Link to comment
https://forums.phpfreaks.com/topic/30301-help-with-the-linking-in-a-dynamic-menu/
Share on other sites

You may need to put " in your "<a href " tag.
because if you echo ?id=Image1 [color=red]Name[/color].
"Name" is one of attribute names of "<a ", so you need to put "..." between your link target

[code=php:0]Print "<a href=\"./sort.php?id=".$info['b_name']."\">".$info['b_name']."</a> <br>" ;[/code]
thankyou so much for your help


I tried it as Print "<a href="./sort_breeder.php?id=".$info['b_name']."">

but that ofcourse gave the errors without the extra parts you added in for me , thankyou ever so much I knew it was goign to be somehtign simple liek that :)

works a dream now  ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.