SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    United Kingdom
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Replacing charcaters

    I've made scripts that allow me to post articles, but it won't let me include the ' character when I submit them. I need to be able to have the ' character. Someone gave me a very vague solution, so if anyone knows one, could you please tell me:

    - what the code is
    - which page I should put it on (the submit article or view article page)

    Thanks for any help
    No one is a virgin, life screws us all

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You will need to do something on both. First on the submit script you need to run addslashes() on your variables before insetting them into the database by using

    $str = addslashes($str);


    Then on the view article before you display the data you need

    $str = stripslashes($str);
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    United Kingdom
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where abouts would I put it on the submit page?
    I've jumped in too much for 3 days of php, heh.
    No one is a virgin, life screws us all

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like I said anywhere before you stick the data in the database. And on the way out anywhere after retrieving the data from database and before you print it to the screen.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


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
  •