mardi 3 juillet 2018

what is difference between these two php code

i am beginner on php programming i want to know the difference between these two, are both doing same thing ?

 Name: <?php
   $name = trim($_GET["name"]);
   $message = trim($_GET["message"]);
   if ($name == "") { 
     echo "You did not give all info!";
   } else {
     echo $name;
   }
   ?><br>

   Message: <?php
   if ($message == "") { 
     echo "You did not give all info!";
   } else {
     echo $message;
   }
   ?>

and this one :

<?php
 if ($_GET["message"]=='' OR $_GET["name"]=='') {
 echo "You did not give all info! \n";
 }
 else {
 echo $_GET["name"].":".$_GET["message"]."\n" ;
            }
  ?>

Aucun commentaire:

Enregistrer un commentaire