I have a page with multiple forms (2 forms) on that page.
There is a callup form and a contacts form in the footer of the page.
So customers may choose to just enter a phone nr and press submit in one form, or they may fill in the other form with name, email, and a message and then press submit.
I am working on a PHP mail() function to separate which form is beeing submitted, however I have forgot alot of programming over the last time, so I turn to you again in asking what to do here.
How can I in the PHP code separate which form has been submitted?
This is what I have in the php right now:
$type = $_POST['type'];
if($type == 'callup'){
$tel_nr = $_POST['tel'];
$to = 'info@domain.se';
$subject = 'Call customer';
$message = 'Client telephone nr is '.$tel_nr.'.';
$message .= '\n';
$message .= 'Client signed in at this date and time: '.date('Y-m-d').' Time: '.date('H:m:s').'';
mail($to, $subject, $message);
}
Basically what I want to do is to send an email to myself when customer submits a form. But depending on which form customer submits, I want to send the corresponding email.
Use multiple names for submitting:
In your first form:
In your second form:
Then, serverside, check for the available names: