By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,742 Members | 793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,742 IT Pros & Developers. It's quick & easy.

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

P: n/a
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?

Jun 12 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"wylbur37" <wy************@yahoo.com> wrote in message
news:11**********************@c74g2000cwc.googlegr oups.com...
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?

Read These From Manual:

http://php.net/manual/en/security.magicquotes.php
When on, all ' (single-quote), " (double quote), \ (backslash) and NULL
characters are escaped with a backslash automatically.

http://php.net/manual/en/function.stripslashes.php
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
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
Jun 12 '06 #2

P: n/a
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:
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?


Jun 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.