|
|
|
|
![]() ![]() |
May 29 2008, 11:00 AM
Post
#1
|
|
|
Premium Member Group: [HOSTED] Posts: 231 Joined: 30-June 07 Member No.: 23,045 |
While my site's more PHP based than straight HTML, the problem I'm having is with trying to do the following:
CODE <a href="page.php?variable=foo "bar" foo">foo "bar" foo</a> Assuming I have a variable set to foo "bar" foo which I want as both the destination of the link to contain and the actual link itself to look like, how can I make it show as such? Currently, the first quote (just before the first bar) is closing the href element (I believe that's the right word, yes?), meaning the link instead points to 'page.php?variable=foo '. The link is displayed on screen correctly. I tried adding slashes to the variable (page.php?variable=foo \"bar\" foo), but that didn't work at all (it still closes before the bar and now I have slashes to look at in the link). Other than using single quotes instead of double ones, is there a way to escape the double quote character? This problem's most likely ridiculously trivial, I'm probably just having a mind blank (or brain fart, as some people I know call them - Mordent This post has been edited by Mordent: May 29 2008, 11:00 AM |
|
|
|
May 29 2008, 12:08 PM
Post
#2
|
|
|
Premium Member Group: [HOSTED] Posts: 495 Joined: 5-November 06 Member No.: 17,016 |
CODE <a href="page.php?variable=foo "bar" foo">foo "bar" foo</a> Just change the outer double quote to single quote would do CODE <a href='page.php?variable=foo "bar" foo'>foo "bar" foo</a> I've just tested on firefox3rc1. It should works on other browser as well |
|
|
|
May 29 2008, 01:54 PM
Post
#3
|
|
|
Premium Member Group: [HOSTED] Posts: 231 Joined: 30-June 07 Member No.: 23,045 |
QUOTE Other than using single quotes instead of double ones... Anyway, after much tinkering I managed to solve my own problem. The answer was to use " instead of ". As the link was created dynamically, I did this using htmlspecialchars() (using PHP). It prints correctly, and the link points to the right place. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 8th October 2008 - 07:41 AM |