hello everyone good I'm trying as I can send a form that contains php to an email WITH PHPMAILER
hello everyone good I'm trying as I can send a form that contains php to an email WITH PHPMAILER
Short answer.
Before assigning to $mail
everything you want to send, execute your queries, save them in a string and concatenate it to your html table. Something like this:
$tabla_php = "<tr class='success'><td>";
for($i = 1 ; $i<=30 ; $i++){
$chalae = 'Charla';
if ($i <10)
$varE = $chalae.'0'.$i;
elseif($i >= 10 and $i <=20)
$varE = $chalae.$i ;
else
{
$chalaee = 'charla';
$varE = $chalaee.$i ;
}
$result = mysql_query('select $varE from tbl_inscripcion_congreso where codBarra= '$rando1n'');
while($fila =mysql_fetch_array($result)){
$valDatos = $fila[$varE] ;
if ($valDatos !='')
$result2 = mysql_query('select expocitor , fecha1 , Hora from tbl_charlas where Charla='$valDatos'');
while($fila2 = mysql_fetch_array($result2))
{
$tabla_php = $tabla_php.$fila[$varE]."</td><td>".$fila2'['expocitor']."</td><td>".$fila2'['fecha1']."</td><td>".$fila2'['Hora']."</td></tr>";
}
}
}
Now, in your string $mail
replaces all that part of php that starts after <tbody>
for what you have in variable $tabla_php
"...<tbody>".$tabla_php."</tbody>..."
The ellipses represent the entire remaining part of the string you have in $mail
.
Long Response
PHP is a language that, in this case, only your server understands, that is, your computer where you are running your web service. What you are doing in this code is saving in the variable $mail
a very large string
that has many things inside, such as HTML tags and tags to start PHP scripts, but in the end, it is only a string. When the person on the other side opens the email, this person's computer only understands that it is a very large string
. Sure, the HTML tags will understand them, but the PHP instructions do not, because it does not have any program installed in PHP that can execute these instructions. You must remember that everything with PHP tags runs on your computer and not on the computers that require the web page.