I am not getting despit of using html entities .

0 MAYANK JINDAL · April 29, 2015
I used htmlentities in day and month .
here is my code.  please help me. 
<?php
  if(isset($_POST['password'])  && isset($_POST['date']) && isset($_POST['month']) ){
  $password = $_POST['password'];
    $date = htmlentities($_POST['date']);
    $month = htmlentities($_POST['month']);
    $match = '12erty';
    if(!empty($_POST['password']) && !empty($_POST['date']) && !empty($_POST['month'])){
    if($_POST['password']==$match){
              echo 'password match';
              echo 'password'.'date'.'month';
    } else {echo 'password incorrect';    echo 'password'.$_POST['date'].$_POST['month'];}
    }           
    else echo 'fill all the fields'  ;
}

?>


<form action = 'tut69.php' method = 'POST'>
PASSWORD :  <br><input type = 'password' name = 'password'><br>
DATE:  <br><input type = 'text' name = 'date'><br>
MONTH :  <br><input type = 'text' name = 'month'><br>
<input type = 'submit'  value = 'Submit'>
</form>

Post a Reply

Replies

Oldest  Newest  Rating
0 Mohamad Mirohamadi · May 2, 2015
You will use htmlentities when you need to sanitize user input and avoid XSS attack.
is this your answer?
0 Peer Ligthart · April 30, 2015
It could be an answer since it's a solution, no need to use htmlentities that way.
0 MAYANK JINDAL · April 30, 2015
this is not the answer of my question.
+1 Peer Ligthart · April 30, 2015
I have a little question, why don't you just use the PHP date() function? It's included and very easy, you won't have to use entities no more.

For more information: http://php.net/manual/en/function.date.php
  • 1

PHP

107,280 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators