Jump to content

php form filter


eerikk2

Recommended Posts

I have a form for people to upload data to a mysql database. I am trying to include a filter to prevent them from uploading explicit terms into any of the spaces. I made the from which when submitted goes to insert.php file which processes all the data and uploads it. here is where i would like to preform the filter. maybe it would be something like

if($_POST ['name']=='@$#'){ header ('Location: example.com')} 

Although i have many form sections and many words i would like to filter out.

The goal is to, if one of the words is detected it would redirect the user to a page which displays why their data was not uploaded.

I've been trying to do this and here is what i've got so far.

//insert.php
include('words.php'); 
if ($_POST['$entered']=="$words"){
header( 'Location: http://example.com/' ) ;
exit;
}

//words.php
//%is used as wildcard in code
$words ="%@$#%||%@$#%||%@$#%||%@$#%||%@$#%||%@$#%||%@$#%";
$entered="Mname||Sname||Lsize||Wsize||Dsize";

Link to comment
https://forums.phpfreaks.com/topic/197519-php-form-filter/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.