SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2002
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    displaying images...

    Hi, I am new to PHP and I am in the middle of writing my first scripts. One of the scripts I am currently writing allows me to enter into the mySQL database, amongst other things a text field. One thing that I would like to be able to do, but I dont seem to be able to figure out how, is that I want to be able to enter the html code for say an image into the text field and then in my main display script I want the image to be displayed instead of the html code (basically I want to write a site where I can add reviews of a product with various images throughout the review). Does anyone have any idea how I would need to go about this or where I should start?
    Thanks for your time

  2. #2
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well since you said you were entering the HTML for the image in the textfield, I'm not sure what the problem is, as when you print it out on the page, the browser will see the HTML and it will put the picture where you put the image tag.

    For example:
    PHP Code:
    // $text actually holds the text you got from the db
    $text 'This is my text <img src="/images/image.gif" /> with an image';

    // this will echo the text with the image in it
    echo $text
    Oh no! the coots are eating my nodes!

  3. #3
    SitePoint Member
    Join Date
    Jan 2002
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doh, now that you said that I just remembered that my script contains the htmlspecialchars function. Sorry, I should have realised that was my problem

    Thanks for the help


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
  •