0

I'm trying to convert a string to be included it in a link href tag. This is what i have now:

<?php 

$title = urlencode(the_title());


?>

<form>
<input type="button" value="Submit Resume" onClick="window.location.href='..../../submit-resume/?job=<?php $title ?>'">
</form>

I can get 'the_title()' to post to URL, but the problem is that the title might have characters such as "R&M Technician" where "&" is cut off from the string once it parse through URL and i can't get the complete value.

output should be R%26M%20Techncian. Currently I'm just getting R&M%20Technician, without %26.

Any help would be much appreciated.

Thanks

  • Aren't you looking for `rawurlencode()`? – Jack Jun 18 '14 at 02:39
  • would there be a diff from urlencode()? – Spencer Lim Jun 18 '14 at 02:49
  • Yes. `rawurlencode()` encode some characters(including `&` which seems you want to encode) which `urlencode()` didn't. Check out this complete information http://stackoverflow.com/questions/996139/urlencode-vs-rawurlencode – Jack Jun 18 '14 at 02:55

0 Answers0