Im working on an inventory website for my company so we can keep track of all assets and where they are incase we ever get audited. They want to be able to send each employee an email listing their currently assigned equipment to make sure the database is up to date and all equipment is where it should be. So far I have successfully emailed a form with all the proper data and have been able to retrieve the results when the client submits the form in their email. PROBLEM: I do not want the client to get redirected to where the form is being submitted. I know an ajax request or something like it is required but Im not sure how to send the ajax code inside the php script. If i had to guess, Id say the ajax code will somehow get added as a string inside the $message variable and the action of the form will be removed. Note all the code here is working as I want it to, Im just giving it so you have an idea of my thought process. I took a lot of this code from: https://css-tricks.com/html-forms-in-html-emails/. Heres some of the code:
enter code here
$message = '<html><body>';
$message .= '<form action = "emailAudit.php" method = "post" target = "_blank">';
$message.='<label> Are you using this equipment?</label><br>';
foreach($equipment as $eq)
{
if(!empty($equipment))
{
$message.= '<input name = "id[]" type = "checkbox" value = '.$eq.'/>' . $eq. '<br>';
}
}
$message .= '<input type = "submit" />Submit <br>';
$message .= '</form></body></html>';
if(!empty($to)){
if(mail($to, $subject, $message, $headers))}