whitty
03-11-2003, 05:25 AM
Ok I've been away with php for a while now but a job requires me to code a backend structure for a site I'm doing.
I have a form that gets the users details, checks them over to make sure everything is on the up and up and then submits it to a database.
I wrote a function to check each input from the form and clean it up a bit by doing htmlspecialchars and addslashes but it doesn't seem to be working.
Function
function cleanupinput($form_vars)
{
foreach ($form_vars as $key => $value)
{
addslashes($value);
}
}
Than in my file I call it by doing a simple call to the function right before it gets inserted.
cleanupinput($_POST);
The data is being inserted fine but no slashes are being added so I'm clearly doing something wrong. It's late and I've been slaving away for a while so it's probably something simple I'm missing here.
Any help would be great.
I have a form that gets the users details, checks them over to make sure everything is on the up and up and then submits it to a database.
I wrote a function to check each input from the form and clean it up a bit by doing htmlspecialchars and addslashes but it doesn't seem to be working.
Function
function cleanupinput($form_vars)
{
foreach ($form_vars as $key => $value)
{
addslashes($value);
}
}
Than in my file I call it by doing a simple call to the function right before it gets inserted.
cleanupinput($_POST);
The data is being inserted fine but no slashes are being added so I'm clearly doing something wrong. It's late and I've been slaving away for a while so it's probably something simple I'm missing here.
Any help would be great.