javascript - Add formatting based on response - POST data sent to email using PHP -
i have form people can fill in there details , share current timetable. go , find times suit people , sort them groups.
currently php form prints variable either 'work' or 'free' (based on selection in form) table , send email contact details , timetable.
is possible assign text color or cell color value particular cell of table, when sending form? (so when receive email cells have 'free' variable in them colored green etc.)
<?php $name_f = $_post['name_f']; $name_l = $_post['name_l']; $phne = $_post['phne']; $cont_em = $_post['cont_em']; $mon09to10h = $_post['mon09to10h']; $tue09to10h = $_post['tue09to10h']; $wed09to10h = $_post['wed09to10h']; ... $to = "email@email.com"; $subject = "new message"; ... $message = <<<eod new form submitted<br><br> <b>name:</b> $name_f $name_l <br> <b>phone:</b> $phne <br> <b>email:</b> $cont_em <br> <table border="1"> <tr><!-- row 1 --> <td></td><!-- col 1 --> <td><span class="table_header">monday</span></td><!-- col 2 --> <td><span class="table_header">tuesday</span></td><!-- col 3 --> <td><span class="table_header">wednesday</span></td><!-- col 4 --> <td><span class="table_header">thursday</span></td><!-- col 5 --> <td><span class="table_header">friday</span></td><!-- col 6 --> </tr> <tr><!-- row 2 --> <td style="width:140px">9 10 am</td><!-- col 1 --> <td style="width:140px; height:40px">$mon09to10h</td><!-- col 2 --> <td style="width:140px; height:40px">$tue09to10h</td><!-- col 3 --> <td style="width:140px; height:40px">$wed09to10h</td><!-- col 4 --> <td style="width:140px; height:40px">$thu09to10h</td><!-- col 5 --> <td style="width:140px; height:40px">$fri09to10h</td><!-- col 6 --> </tr> <tr><!-- row 3 --> <td>10 11 am</td><!-- col 1 --> <td style="width:140px; height:40px">$mon10to11h</td><!-- col 2 --> <td style="width:140px; height:40px">$tue10to11h</td><!-- col 3 --> <td style="width:140px; height:40px">$wed10to11h</td><!-- col 4 --> <td style="width:140px; height:40px">$thu10to11h</td><!-- col 5 --> <td style="width:140px; height:40px">$fri10to11h</td><!-- col 6 --> </tr> ... </table> eod; // send mail if (isset($_post['send'])) { $sent = mail($to, $subject, $message, $headers) ; if($sent) echo "success!" } else { echo "error." } ?>
you can use this.
if $type == "work"{
echo '<div style="color:red">work</div>'; }
if $type == "free"{
echo '<div style="color:green">free</div>'; }
Comments
Post a Comment