marz Posted January 22, 2012 Share Posted January 22, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/255503-crazy-maker-passing-variable-to-variables-with-quotes/ Share on other sites More sharing options...
marz Posted January 22, 2012 Author Share Posted January 22, 2012 PS: $history is passed to the next page by hidden form input and use $_REQUEST to get data PS2: Without the <a href tag, things works well! so it is something to do with > or " but I can't see the problem. Quote Link to comment https://forums.phpfreaks.com/topic/255503-crazy-maker-passing-variable-to-variables-with-quotes/#findComment-1309987 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.