Send variable from html to php

0

I have the following code

<tr>
    <td> <?php echo $mostrar['nombre'] ?> </td>
    <td> <?php echo $mostrar['tel'] ?> </td>
    <td> <?php echo $mostrar['celular'] ?></td>    
    <td>
       <a href= "fmodpsi.php?id=" >
       <img src="../assets/images/edit.png" onclick="#"   /> 
    </td>  
    <td>
      <img src="../assets/images/delete.png" onclick="#" /> 
    </td>  
</tr>

In that modify button I want to send a value of the array, but the table is in HTML, how I send the variable, if I do it in the following way and it does not work for me.

<td> <a href= "fmodpsi.php?id=".$mostrar['id'] > 
  <img src="../assets/images/edit.png" onclick="#"   />
</td>  

Greetings, thank you.

    
asked by Sergio Montoya 23.05.2018 в 22:40
source

1 answer

2

You can send parameter or values in the link by the GET method as ?clave=valor&clave2=valor2 . Simply open and close the php tags ( <?php ... ?> ) as you do with the rest or use the tags <?= ... ?>

For example:

<a href= "fmodpsi.php?id=<?= $mostrar['id']; ?>" > 
  <img src="../assets/images/edit.png" onclick="#"   />
</a>

or

<a href= "fmodpsi.php?id=<?php echo $mostrar['id']; ?>" > 
  <img src="../assets/images/edit.png" onclick="#"   />
</a>

You can find the documentation here: link

    
answered by 23.05.2018 в 22:55