Results 1 to 4 of 4

Thread: PHP POSTing with quotes

  1. #1

    Thread Starter
    Hyperactive Member dandono's Avatar
    Join Date
    Aug 2004
    Location
    Cornwall, UK
    Posts
    485

    PHP POSTing with quotes

    Hi, I have a normal form with a textbox and if i type something like
    Code:
    John said "Hello"
    then wrote that to a text file and then i opened the text file its contents would say
    Code:
    John said /"Hello/"
    How can i stop this from happening?
    Thanks, dandono.
    If there is only one perfect person in the universe, does that make them imperfect?

  2. #2
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    266

    Re: PHP POSTing with quotes

    just replace / with blank space bcoz " can't be entered in a string as string is any thing enclosed in quotes...So it converts it in escape sequence ... if u want it not to include / then u need to replace it.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: PHP POSTing with quotes

    If it's \" then you must have magic quotes on. Use stripslashes() to remove backslashes from quotes.

  4. #4

    Thread Starter
    Hyperactive Member dandono's Avatar
    Join Date
    Aug 2004
    Location
    Cornwall, UK
    Posts
    485

    Re: PHP POSTing with quotes

    I didnt think of that. I thought i had to go through php.ini or something. I used this:
    PHP Code:
    <?php
    $text
    =$_POST['txt'];
    $text=str_replace('\"',"&quot",$text);
    ?>
    Thanks, dandono.
    If there is only one perfect person in the universe, does that make them imperfect?

Posting Permissions

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



Click Here to Expand Forum to Full Width