[vox-tech] php and forms question

Peter Jay Salzman vox-tech@lists.lugod.org
Mon, 6 Jan 2003 14:54:44 -0800


there's a page i've been tinkering with, off and on, to teach myself
php.  it's a cryptogram page:

http://www.dirac.org/p/crypto/index.php

i have some data that i pass using hidden form fields, like this:

print "<FORM action=\"index.php\" method=\"post\">\n";
print "<INPUT type=\"hidden\" name=\"PlainText\" value=\"$PlainText\">\n";
print "<INPUT type=\"hidden\" name=\"CipherText\" value=\"$CipherText\">\n";

when the user presses the submit button, any apostrophes or backslashes
within $PlainText or $CipherText get backslashed.   Like this:

before pressing submit:
TO TEST A MAN'S CHARACTER,

1st time submit is pressed:
TO TEST A MAN\'S CHARACTER,

2st time submit is pressed:
TO TEST A MAN\\'S CHARACTER,

and so on.  i'm not sure why or how the backslashes are entering the
string.  without really knowing why this is happening, i tried to remove
the symptom by brute force:

$PlainText = ereg_replace('\\([[:punct:]])', \\1, $PlainText);
$CipherText = ereg_replace('\\([[:punct:]])', \\1, $CipherText);

but php didn't like the backslashes.

i'm kind of lost.  any ideas?

pete

-- 
First they ignore you, then they laugh at you, then they fight you,
then you win. -- Gandhi, being prophetic about Linux.

Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D