Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php clean user input

<?php
    function cleanUserInput($userinput) {
  
  		// Open your database connection
      	$dbConnection = databaseConnect();
  
  		// check if input is empty
        if (empty($userinput)) {
          return;
        } else {
          
        // Strip any html characters
        $userinput = htmlspecialchars($userinput);
        
		// Clean input using the database  
        $userinput = mysqli_real_escape_string($dbConnection, $userinput);
        }
       
  	  // Return a cleaned string
      return $userinput;
    }
?>
Comment

PREVIOUS NEXT
Code Example
Php :: laravel db table get one columns value 
Php :: null value in php 
Php :: magento 2 get number of cart items 
Php :: php timestamp to iso8601 
Php :: on running php file showing code instead of view 
Php :: laravel create controller 
Php :: laravel database seeder 
Php :: img upload in php 
Php :: php unique assoc array by value 
Php :: slugify text in php 
Php :: phpmailer addattachment 
Php :: insertion sort in php 
Php :: trait php 
Php :: random string value laravel 
Php :: send json reponse php 
Php :: switch php versions 
Php :: ternaire echo isset php 
Php :: php last item of array 
Php :: Update First and Last Day of Previous Month with Carbon 
Php :: read xml file in php wordpress 
Php :: get specific word from string php 
Php :: worpdress pods taxonomy get custom field 
Php :: Undefined constant "STDOUT" in php 
Php :: eloquent batch insert 
Php :: how to add column to database in laravel 
Php :: laravel model set new attribute 
Php :: how to use include in php 
Php :: php function to remove 0 value from array 
Php :: faker instance in tinker 
Php :: microft access request database with pdo 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =