mailto body from php

0

I have this code

 <table width=100% border="5" align="center" cellpadding="0" cellspacing="1">
  <tr>
    <th width=12% align="center" scope="col">nombre</th>
  </tr>
  <tr>
  <?php $customers = "select * from x where nombre <> ''";
    while ($customers) {?>
    <th align="center" scope="col"><?php echo $customers['nombre']; ?></th>
    <?php } ?>
  </tr>
</table>

is a query to be displayed on a screen, it is in php, I can do a mailto and the result shown in this screen copy it in Body =

Example:

<A HREF="mailto:[email protected]?Subject=ejemplo&Body=prin%20te%20la%20tabla">Enviar Correo</A>

where the &Body= is the result of the aforementioned query?

I need to click on SEND MAIL copy the result of the query in body , I do not know if I need to add a java function or something that can read php and convert it into text with the spaces using %20

    
asked by Ivan Diaz Perez 24.08.2017 в 18:34
source

2 answers

1

Hello, you should store the names first with a while, for example, according to your code:

$nombres = "";
while($customers){
    $nombres = $nombres . $customers['nombre'];
}

Then

<a href="mailto:[email protected]?Subject=ejemplo&Body="<?php echo $nombres; ?>">Enviar Correo</a>

Consider that you can not include html tags (for the table) because with mailto as far as I remember, your body works with text / plain

    
answered by 24.08.2017 / 19:09
source
1

I think you're looking for the urlencode() function that encodes a text string as a URL.

Then you would use something like this:

<a href="mailto:[email protected]?Subject=ejemplo&Body="<?php echo $customers['nombre']; ?>">Enviar Correo</a>

I have not tried the code, but the idea is that.

There are other functions that can also help you. Check the documentation .

    
answered by 24.08.2017 в 18:42