Form Sanitize using filter_var() and html entities() in PHP -


my input must validated using filter_var() , html_entities().

heres code doesn't work:

session_start();  if(empty($_post['add']) === false ) {      $name =    filter_var(input_post, 'name', filter_sanitize_string);     $email =   filter_var(input_post, 'email', filter_sanitize_email);     $phone =   filter_var(input_post, 'phone', filter_sanitize_int);     $address = filter_var(input_post, 'address', filter_sanitize_string);   } ?> 

when test , put "frost" name input comes out in bold not suppose to. after done needs write out $_session['cart']. im lost @ point

from comments far can see: if $_get variable contains array, not posting html form right. use post-ing html <form>:

<form action="/path/to/script.php" method="post" enctype="multipart/form-data"> <!-- input fields --> </form>

also, peter van der wal said, use filter_input() function instead of filter_var() if want use input_post. otherwise use filter_var($_post['input_name'], filter_sanitize_string).

for more post more html code

if new coding/php suggest familiarize w3schools , php documentation. quite useful if understand these resources. way start learning.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -