1

? and = will be used as parts in my url. In generating the url, I use

<?php echo l('node/'. $someID .'/delete?destination=chapter/'. $anotherID);?>. When I check on Firebug, the href attribute of the link is not the usual url, instead of having ?, it is being replaced with %3F and = is being replaced with %3D. How do I fix this?

1

2 Answers 2

1

To generate URL we use url() function. l() function is used to generate a text with link. See the example below:

// Generate a Text with link
echo l('Link Text', 'node/' . $nid . '/delete', array('query' => array('destination' => 'chapter/' . $cnid)));

// Generate a Link.
echo url('node/' . $nid . '/delete', array('query' => array('destination' => 'chapter/' . $cnid)));
0

Try:

 <?php echo l('/node/'. $someID .'/delete?destination=chapter/'. $anotherID,'/node/'. $someID .'/delete?destination=chapter/'. $anotherID);?>

And you will see what Jimajamma is talking about. The first string is converted to special characters to display on the page. The second string becomes the href="" string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.