Addslashes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi all,

i'm really buffled by what i got and would appreciate any help possible! although i addslashes and stripslashes, i still get a backslash ( \ ) character infront of a single inverted comma ( ' ) and also whenever an amberscend ( & ) appears... please help! thanx thanx..

for example:

in my form (form.php), i have something like that:

<input type="text" name="field1" value="<? if ($form["field1"]) echo stripslashes($form["field1"]); ?>">

upon submitting the form, the verification file (verify.php) will be executed, and it has lines like that:

<?
      session_register("form");

      foreach($_POST as $varname => $value)
           $form[$varname] = addslashes(trim(EscapeShellCmd($value)));
?>

... and then i'll check for the validity of field1. if there is an error, the user will be redirected back to form.php with the value that the user entered echoed with a stripslash.

if there is no error, the whole script runs well, but if the user has to be brought back to form.php, it'll print backslashes infront of characters like "(   )  '  &" etc..

also, instead of having a blank text field, i have a text field with contents retrieved from the database.. the database data does not have the slashes and when the first time they appear on the screen, there is no slashes attached too.. the problem is always when the user has an error and needs to be brought back to form.php that the slashes appear and the number of slashes doubles everytime the user has to be brought back to form.php.

i have my magic_quotes_gpc set to ON in my phpinfo() and my version of php is 4.1.2.

thank you soo soo much!!

look forward to your replies.

hwee


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux