JeremyH
05-02-2006, 05:29 PM
I'm learning PHP and have a question...
I want to remove some characters from form input. Using this:
$comment = str_replace('example', 'Example', $comment);
works great, but how would I replace more than one charcter or string? Would it be done with an array? I knew how to with Perl, but I can't find the equivilent in PHP.
Also, for security purposes, would removing characters like ";<>&*~|#" from the form input be a good start in keeping my forms less open to sneaky coders? Maybe replacing those characters with the ISO character set numbers? This is for a guestbook-type page, so I feel that high security isn't that necessary for the file the input is being written to. I just don't want people to be able to screw around with other files via the form.
Any tips?
I want to remove some characters from form input. Using this:
$comment = str_replace('example', 'Example', $comment);
works great, but how would I replace more than one charcter or string? Would it be done with an array? I knew how to with Perl, but I can't find the equivilent in PHP.
Also, for security purposes, would removing characters like ";<>&*~|#" from the form input be a good start in keeping my forms less open to sneaky coders? Maybe replacing those characters with the ISO character set numbers? This is for a guestbook-type page, so I feel that high security isn't that necessary for the file the input is being written to. I just don't want people to be able to screw around with other files via the form.
Any tips?