POST input_filter() in PHP

Hello
Today I am going to show the details about the input_filter() function in PHP for POST method. In this case, we have to create 2 files entitled form.php and form_process.php files. So, let’s start the work-

form.php

<?php
echo showIt();
function showIt(){
$r = ”;
$r .= ‘<form method=”POST” action=”inputFilter.php”>’;
$r .= ‘<table>’;
$r .= ‘<tr><td>ID :</td><td><input type=”text” name=”id2″/> (must be between 3 and 10)</td></tr>’;
$r .= ‘<tr><td></td><td><input type=”submit” name=”submit” value=”POST”/></td></tr>’;
$r .= ‘</table>’;
$r .= ‘</form>’;
return $r;
}
?>

Now, I am going to write the code for form_process.php file. The code is below-

<?php
$id = filter_input(INPUT_POST, ‘id’, FILTER_VALIDATE_INT, array(‘options’=>array(‘min_range’=>3, ‘max_range’=>10)));
 
if(is_null($id)){
       echo “The ID arguments is missing”;
}elseif($id === false){
       echo “The ID argument must be an integar between 3 and 10”;
}else{
       echo “ID is valid : $id”;
}
?>

 

Ok, now run the file of form.php and write the code. Hope it’s ok now. Everything is going well. Isn’t it? Sound good.

Thanks for reading. Bye.

CREATING A WEBSITE IN REDESIGN POLICY

Want to redesign your website? A redesign can be a huge success – or some time it could fail miserably. But it’s a creative and researchable process. That’s why this research paper. It doesn’t matter where you are redesigning your website if you have a clear goal. By this research paper, you will get a policy to redesign your website properly.

Statistic shows that, every redesign comes with problem/s.  So, the better is you are defining this/ese problem/s at the very beginning of success. We are concern about your invest and try to find the proper policy to make it success. So, this paper guide you in this case exactly solve out. So, let’s start the journey…

Do you want to know the policies?

Thanks for reading…