Help Uncaught Error: Syntax error, unrecognized expression

0

I'm making a page for the school and I have a problem with the announcements. This is the code where the problem is

      <?php 
    if (isset($_SESSION['username']) && $_SESSION['rol']=='administrador' OR isset($_SESSION['username']) && $_SESSION['rol']=='Padre' OR isset($_SESSION['username']) && $_SESSION['rol']=='Docente'){
     echo '<button type="button" class="btn btn-primary  btn-sm"   onclick="cargar(\'#capa_d\',\'alta_co.php\')">Nuevo Comunicado</button>';
echo '<button type="button" class="btn btn-primary  btn-sm"   onclick="cargar(\'#capa_L\',\'mostrar_comunicados.php?b='.$_SESSION['lastname'].'&n='.$_SESSION['name'].'\')">Ver Comunicados</button>';
echo '<button type="button" class="btn btn-primary  btn-sm"   onclick="cargar(\'#capa_d\',\'mostrar_comunicados.php?a='.$_SESSION['lastname'].'&j='.$_SESSION['name'].'\')">Mis comunicados</button>';
    }
  ?>

And the problem comes when $ _SESSION ['lastname'] are two last names and not just one , I mean instead of being "Gutierrez" is "Gutierrez Gonzalez" the error that jumps in the console is:

Uncaught Error: Syntax error, unrecognized expression: Gutierrez&n=Milo

I hope you explained well, Thanks for any help. Here the code of the function load

   <script>
   function cargar(div,desde)
   {
   $(div).load(desde);
   } 
   </script>
    
asked by Santiago Faverio 12.09.2018 в 01:28
source

0 answers