Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Creating Links With Quotes (")
Mordent
post May 29 2008, 11:00 AM
Post #1


Premium Member
Group Icon

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 tongue.gif ), so any help would be appreciated.

- Mordent

This post has been edited by Mordent: May 29 2008, 11:00 AM
Go to the top of the page
 
+Quote Post
faulty.lee
post May 29 2008, 12:08 PM
Post #2


Premium Member
Group Icon

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
Go to the top of the page
 
+Quote Post
Mordent
post May 29 2008, 01:54 PM
Post #3


Premium Member
Group Icon

Group: [HOSTED]
Posts: 231
Joined: 30-June 07
Member No.: 23,045



QUOTE
Other than using single quotes instead of double ones...

wink.gif

Anyway, after much tinkering I managed to solve my own problem. The answer was to use &quot; 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. smile.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Inspirational Quotes(17)
  2. Creating A Game In Rpg Maker 2000/2003(18)
  3. 3ds Max Tutorial #2-creating Reflective Materials(1)
  4. Creating You Own Game In RPG Maker 2000/2003(12)
  5. How Do I Create And Write To Files?(4)
  6. Creating Tooltips(7)
  7. Permission Denied In Creating A Directory(6)
  8. Alt Txt Tooltip Popups Over Text Links, How To Do?(11)
  9. Creating Irc Chat Room...(9)
  10. Creating Your Own Simple But Effective Site(26)
  11. Creating Executable Jar Files(9)
  12. Creating New Process Under Alternate Credentials (createprocessasuser)(6)
  13. Tutorial: Dreamweaver, 3ds Max, Flash, Html, Css(8)
  14. Please No Links In The Shoutbox, Find Out Why(24)
  15. Creating Flash Image/slideshow(2)
  1. Help Creating A Browser-based Rpg(5)
  2. Best Software For Creating Games(9)
  3. Creating Interactive Pdf Documents(2)
  4. Developer - Computer - Quotes(1)
  5. Creating Dll With Delphi(0)
  6. Altiris Deployment Server: Creating Boot Disks (remote)(2)
  7. Creating Your First Application(1)
  8. Help Me Creating My Text Based Game.(2)
  9. Creating Bootable Cds(1)
  10. Magic Quotes And $_files(3)
  11. 3d Game Creating Thing(1)
  12. Creating A Php Login Script(3)
  13. Some Useful Database Links.(7)


 



- Lo-Fi Version Time is now: 8th October 2008 - 07:41 AM