SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    nyc
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    array values contain quotes, problem...

    I have an array like this:
    $image = array('image.JPG','title','14\" x 18\"','oil on canvas');

    (In the array, I am adding slashes to escape the double quotes).

    Now, I want to echo $image[2] in an input text box:

    <input type="text" name="dimensions" value="<?php echo $image[2]; ?>">

    The text box shows:
    14\
    instead of
    14\" x 18\"

    If I use stripslashes($image[2])
    the text box then shows:
    14

    The array value is only returned up to the first double quote, in a text box!
    Why?
    What can I do?...

  2. #2
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this!
    PHP Code:
    $image = array('image.JPG','title','14&quot; x 18&quot;','oil on canvas');
    print 
    $image[2];
    // returns 14" x 18" 

  3. #3
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    nyc
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks that did it


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •