quotations problem with echo("") command

This is a discussion on quotations problem with echo("") command within the PHP Language forums, part of the PHP Programming Forums category; Running php4.3.6 What i'm trying to do is exactly like the weather channell site when you click ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-16-2004
brianj
 
Posts: n/a
Default quotations problem with echo("") command

Running php4.3.6
What i'm trying to do is exactly like the weather channell site when
you click in the zip code box the text dissapears and you are free to
type your zip.
I can make it work by using this command:
onfocus="this.value=''"
but i want to generate the string with php by using the echo("write
something here"); command.
Obviously the problem here is the double_quotes i need are screwing up
the command.Have tried using special characters and adding slashes.
which both work to a degree. The page doesn't bomb but the onfocus
still doesn't function. wtf how do i make it work??


time is 6:31pm Central
Reply With Quote
  #2 (permalink)  
Old 11-16-2004
Pedro Graca
 
Posts: n/a
Default Re: quotations problem with echo("") command

brianj wrote:
> The page doesn't bomb but the onfocus
> still doesn't function. wtf how do i make it work??


Disclaimer: I don't know JavaScript.
Maybe you get more comprehensive answers in a JavaScript newsgroup.

<?php

echo 'onfocus="this.value=\'write something here\'"';

echo "onfocus=\"this.value='write something here'\"";

$double_quote = '"';
$single_quote = "'";
echo 'onfocus=', $double_quote, 'this.value=', $single_quote,
'write something here', $single_quote, $double_quote;

?>

--
Mail sent to my "From:" address is publicly readable at http://www.dodgeit.com/
== ** ## !! !! ## ** ==
TEXT-ONLY mail to the complete "Reply-To:" address ("My Name" <my@address>) may
bypass the spam filter. I will answer all pertinent mails from a valid address.
Reply With Quote
  #3 (permalink)  
Old 11-16-2004
brianj
 
Posts: n/a
Default Re: quotations problem with echo("") command ->Thanks

>
> <?php
>
> Hey thanks a lot man this one here worked.
> echo "onfocus=\"this.value='write something here'\"";

I thought I tried that but apparently not.
Mucho Gracias
>
>
> ?>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:53 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0