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
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]
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.