If you submit a form:
Code:
<form action="#">
<input type="hidden" name="category" value="c++"> <input type="submit" value="c++">
</form>
This is the resulting URL:
.php?category=c%2B%2B#
Some browsers do not automatically add the empty hash, which is inconsequential. If you have a real URL as the action it won't happen, the action can even have its own non-empty hash.
You can style a submit button to look like a link, set the action to whatever page you want it to go to, and you're all set.
Edit: I just checked. In IE it loses its ClearType anti-aliasing if you style the font, so you might want to use a javascript assist to have an ordinary link submit the form, at least for IE. Or - if you don't mind having a button, use it as a submit button with it's value set as desired, as in the above.
Or - this works out rather well cross browser, if you can live with the font:
Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
form.link {
margin: 0;
padding: 0;
display: inline;
}
form.link input {
background-color: transparent;
border-width: 0;
cursor: pointer;
}
</style>
</head>
<body>
<form class="link"action="#">
<input name="category" type="submit" value="c++">
</form>
</body>
</html>
However, I just checked again, this works just fine:
Code:
<a href="whatever.php?category=c%28%28">c++</a>
What kind of problem were you having? If the URL is script generated, all you should have to do is either encodeURL() or encodeURLComponent() it.
Bookmarks