I thought I'd include a common loop I use with form variables to get them database ready. It runs addslashes on every variable received from a "POST" type form:
<?php
Reset($HTTP_POST_VARS);
While(List($key, $val) = each($HTTP_POST_VARS)) {
$$key = addslashes($val);
}
?>
You could also replace the addslashes part in the loop with str_replace if you prefer. Of course, this assumes you don't have magic-quotes enabled. 🙂
John Cornett