Backslashes from textbox forms are returned as double-backslashes. Why?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • wylbur37

    #1

    Backslashes from textbox forms are returned as double-backslashes. Why?

    When using a form with an input textbox such as the following ...

    <input type="text" name="field1" size=30>

    I discovered that when a backslash (\) is typed into the textbox,
    when I later check the value (in $field1), I get *two* backslashes.
    For example, If I type ...

    c:\abc\xyz

    the $field1 variable will then have a value of ...

    c:\\abc\\xyz

    Why does this happen?

  • Kimmo Laine

    #2
    Re: Backslashes from textbox forms are returned as double-backslashes. Why?

    "wylbur37" <wylbur37nospam @yahoo.com> wrote in message
    news:1150116106 .703791.228640@ c74g2000cwc.goo glegroups.com.. .[color=blue]
    > When using a form with an input textbox such as the following ...
    >
    > <input type="text" name="field1" size=30>
    >
    > I discovered that when a backslash (\) is typed into the textbox,
    > when I later check the value (in $field1), I get *two* backslashes.
    > For example, If I type ...
    >
    > c:\abc\xyz
    >
    > the $field1 variable will then have a value of ...
    >
    > c:\\abc\\xyz
    >
    > Why does this happen?[/color]


    Read These From Manual:

    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

    When on, all ' (single-quote), " (double quote), \ (backslash) and NULL
    characters are escaped with a backslash automatically.


    Returns a string with backslashes stripped off. (\' becomes ' and so on.)
    Double backslashes (\\) are made into a single backslash (\).

    --
    "ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
    spam@outolempi. net | Gedoon-S @ IRCnet | rot13(xvzzb@bhg byrzcv.arg)


    Comment

    • ImOk

      #3
      Re: Backslashes from textbox forms are returned as double-backslashes. Why?

      Obviously a \ is an escape character in literal strings. E.g. \n \r \t
      and so on.

      So something somewhere is escaping the \ in the path name otherwise
      your path name may not come across correctly.

      How are you "checking" $field1 and are you passing it as a query
      string? You need to be more specific.



      wylbur37 wrote:[color=blue]
      > When using a form with an input textbox such as the following ...
      >
      > <input type="text" name="field1" size=30>
      >
      > I discovered that when a backslash (\) is typed into the textbox,
      > when I later check the value (in $field1), I get *two* backslashes.
      > For example, If I type ...
      >
      > c:\abc\xyz
      >
      > the $field1 variable will then have a value of ...
      >
      > c:\\abc\\xyz
      >
      > Why does this happen?[/color]

      Comment

      Working...