lundi 30 décembre 2019

I have problem with my value javascript element id inside php condition

Example i have variable in javascript

var a = "60";
var b = "60";
document.getElementById('a').innerHTML = a;
document.getElementById('b').innerHTML = b; 

And i want pass the element id in php code and then compare a and b

<?php
  $a = '<p id="a"></p>';
  $b = '<p id="b"></p>';

  echo $a; //this result is 60
  echo $b; //this result is 60

  if($a == $b){
     echo 'true';
  } else {
     echo 'false';
  }
?>

my expetasion the result will be true but the reality is false, anything wrong with my code?, i tried to parse the variable and this method not working.

Aucun commentaire:

Enregistrer un commentaire