Jump to content

Crazy maker - Passing variable to variables with quotes


marz

Recommended Posts

I am trying to achieve something that appears simple but  I spent few hours in vain

 

 

 

$tag1 = '<a href="layout_m.php?k='.$k.'&name='.$name.'&type='.$type.'">';

 

if ($k=="1") {$history = ucfirst($name) . ' - ' . $tag1 . $k .'</a>'  ; }

else {$history = $history . ' - '. $tag1 . $k . '</a>' ;}

 

print $history;

 

This is part of a page which is involved in passing data by forms or/and URL (eg layout.php?k=1) and the display of the page depends on k.

 

 

At k=1,(first page)  things are ok [Joe -  <a href="layout_m.php?k=1&name=Joe&type=genus"> 1 </a>]

 

but on passing to the next page, the output is not as desired

 

part of the variable is escaped out on the browser and breaks the variable content

 

 

View source gives this:

Joe -  <a href= -  <a href="layout_m.php?k=3&name=Joe&type=genus"> 1 </a>

 

while I want:

 

Joe -  <a href="layout_m.php?k=1&name=Joe&type=genus"> 1 </a> -  <a href="layout_m.php?k=3&name=Joe&type=genus"\> 3 </a>

 

What I achieve to do is a simple history based on an accumulation of k

 

EG Joe - 1 - 3 - 5 - 6 - 8  Where each number (k) is linked and when pressed each go to the corresponding keypage.

 

 

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.