Problems with speech marks

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kdidymus
Forum Contributor
Posts: 196
Joined: Tue May 13, 2008 3:37 am

Problems with speech marks

Post by kdidymus »

Folks.

This is driving me crazy. Hoping somebody may be able to help.

In short, I'm trying to implement some Javascript in my page which will allow a Textbox Watermark. The Javascript and CSS is written. All I need to do is add the HTML part of the code to my PHP. And this is where I've hit a stumbling block.

The following code works fine in HTML but won't work in my PHP because of the speech marks. If I swap out the speech marks and use apostrophes instead, the page generates errors.

Code: Select all

<input type='text' name='urn' [color=#FF0000]class="gatherZip" id="theTextBox" onblur="showWatermark('theTextBox')" onfocus="hideWatermark('theTextBox')"[/color]></input><input type='submit' name='submit' value='Jump!'></input>
Any idea how I can get this code to work? The section in red is the code I'm trying to add. The bits in black are from my existing PHP.

I've tried escaping the innermost apostrophes but it still doesn't work. Aargh!

Many, MANY thanks.

KD.
kdidymus
Forum Contributor
Posts: 196
Joined: Tue May 13, 2008 3:37 am

Re: Problems with speech marks

Post by kdidymus »

Solved it.

Just added a slash before the speech marks.

One word...

DOH!
Post Reply