Forum Moderators: coopster

Message Too Old, No Replies

Making a link

         

j05hr

12:35 pm on Nov 13, 2009 (gmt 0)

10+ Year Member



How can I put this link in here


echo "<a href=\"buying.php?page=" . urlencode($subject["id"]) .
"\">{$subject["menu_name"]}</a>"; echo"</div>";

I'm not sure how much of that code I need, but all I want is the link, I want it to go in the menu-name div.

$div = '<div class="menu-name"> ' . $row['menu_name'] .'</div><div class="buying-text">';

The link is part of a function from an include file

function public_navigation($sel_subject = null, $sel_page = null) {
$subject_set = get_all_subjects();
// 5. Use returned data
while ($subject = mysql_fetch_array($subject_set)) {

/*----*/

if(!isset($_GET['page'])) {
echo "<div class=\"menu-name\">"; echo "<a href=\"buying.php?page=" . urlencode($subject["id"]) .
"\">{$subject["menu_name"]}</a>"; echo"</div>";
echo "<div class=\"buying-text\">"; echo "{$subject["content"]}"; echo"</div>"; echo "<div class=\"image\">"; echo"</div>";

}//



}
}


Any help much appreciated

andrewsmd

4:45 pm on Nov 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not really for sure what your issue is? If you want to echo a link just use
echo("<div class=\"menu-name\">");
echo("<a href=\"buying.php?page=" . urlencode($subject["id"]).
"\">{$subject["menu_name"]}</a>");
echo("</div>");

If you can explain more then I can help more.

j05hr

6:06 pm on Nov 13, 2009 (gmt 0)

10+ Year Member



I want that link
 echo "<a href=\"buying.php?page=" . urlencode($subject["id"]) . 

On this line, but for the menu-name div and not the buying-text

$div = '<div class="menu-name"> ' . $row['menu_name'] .'</div><div class="buying-text">'; 

If you want a better explanation let me know,
thanks Josh

andrewsmd

6:57 pm on Nov 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think we are at the root of your problem here. What is it, is the link not showing? Have you checked your if statement to make sure it is true? Have you looked at the source code to see if the correct source is being outputted. When I use this code note: I set variables to static values for testing purposes

$subject = Array();

$subject["id"] = 5;
$subject["menu_name"] = "test";
$subject["content"] = "some content";

echo("<div class=\"menu-name\">");
echo("<a href=\"buying.php?page=" . urlencode($subject["id"]) . "\">{$subject["menu_name"]}</a>"); echo("</div>");
echo "<div class=\"buying-text\">"; echo "{$subject["content"]}"; echo"</div>"; echo "<div class=\"image\">"; echo"</div>";

I get the html equivalent
<div class="menu-name"><a href="buying.php?page=5">test</a></div><div class="buying-text">some content</div><div class="image"></div>