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.

 

 

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.