i have an admin page that collects the data from a form user submitted in the form of a table . i want to have a button that recognize the user email column when clicked and send them a premade email.
of course ive looked around but all of the ones with similar problem as me have it so their form is also in the same page as the button so they can do $_POST and mailto. i cant do that because the form is in different page.
this is the table where admin sees user info
<td><?php echo $v['telephone']; ?></td>
<td><?php echo $v['email']; ?></td>
<td><?php echo $v['website']; ?></td>
and then this is the button an admin would press to send it
<input type="submit" value="Send confirmation" />
<input type="hidden" name="button_pressed" value="1" />
and under it is the php code to send it
<?php
if(isset($_POST['button_pressed']))
{
$to = $v['email'];
$subject = 'ayayay';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
echo 'Email Sent.';
}
?>
nothing seems to happen when i click it. and of course i dont actually get the email either. What am i missing here?
i have header tag up above either, not sure if it actually does anything for this page but i looked around and they said it might help but it didnt
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
Thank you