#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    7
    Rep Power
    0
    Say you have a form with a textarea. Say you type something with single-quotes (e.g. I'm happy so I'm sad) in the textarea. When the textarea is POSTed to a PHP program, are they escaped with the backslash?

    I ran it on two different servers and one did and one didn't. Why is this? Is there some setting somewhere? Or is this a version diff thing?

    Here is the PHP code (I changed all angle brackets to square ones so it'll appear):

    [html]
    [form method="post"]
    [textarea name="sometext" wrap="virtual" cols=55 rows=4][/textarea]
    [input type="submit" value="Save"]
    [/form]
    [?php
    echo "Just received: $sometext -- are the single quotes escaped?[p]";
    ?]
    [/html]

    Thanks for any help!

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Ontario, Canada
    Posts
    498
    Rep Power
    18
    put $sometext in a stripslashes() function. eg;

    <?php printf("Just received: %s -- are the single quotes escaped?",stripslashes($sometext));?>


    ------------------
    To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    79
    Rep Power
    15
    One of the servers probably had magic quotes switched on while the other didn't.

    Basil

Similar Threads

  1. Replies: 6
    Last Post: December 21st, 2003, 04:24 PM
  2. Windows 2003 NAT on single interface
    By gearip in forum Windows Help
    Replies: 0
    Last Post: November 15th, 2003, 07:39 AM
  3. xsl - how to escape single quotes
    By hedge in forum XML Programming
    Replies: 1
    Last Post: November 7th, 2003, 07:11 PM
  4. DNS single lable hostname problem
    By rdore in forum DNS
    Replies: 0
    Last Post: September 3rd, 2003, 11:43 AM
  5. Can you make a single php file handle all/most requests
    By md_doc in forum PHP Development
    Replies: 4
    Last Post: May 29th, 2003, 07:44 AM

IMN logo majestic logo threadwatch logo seochat tools logo