Hello there experts
Can anybody help me with a simple solution to my problem? I have a form that works fine, I do receive the email with the information filled in the online form but not the info about :
>> which of the 2 radio button has been checked<<. Yes I just started with php so apologies if the solution is obvious  and thaks in advance.
Script:
PHP Code:
<?php try { if (empty($_POST)) { throw new Exception('Invalid entry point', - 1); } $requiredPostVars = array('name' , 'email' , 'message'); $form = array(); //Mandatory fields check foreach ($requiredPostVars as $field) { if (! isset($_POST[$field])) { throw new Exception('Mandatory field missing: ' . $field, - 2); } $form[$field] = stripslashes(trim($_POST[$field])); if (empty($form[$field])) { throw new Exception('Mandatory field empty: ' . $field, - 3); } } //E-mail address validation if(!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $form['email'])) { throw new Exception('Invalid e-mail address: ' . $form['email'], - 4); } include_once 'class.phpmailer.php'; $body = '<b>Naam</b>: ' . $form['name'] . '<br/><br/>' . '<b>E-mail</b>: ' . $form['email'] . '<br/><br/>' . '<b>Bericht gaat over</b>: ' . $form['value'] . '<br/><br/>' . '<b>Vraag of opmerking</b>: ' . nl2br($form['message']); // Send Mail $mail = new PHPMailer(); $mail->From = "[EMAIL="info@blabla.nl"]info@blabla.nl[/EMAIL]"; $mail->FromName = $mail->From; $mail->Subject = "E-mail vanaf contactformulier [URL="http://www.blabla.nl"]www.blabla.nl[/URL]"; $mail->AltBody = strip_tags(str_replace('<br/>', PHP_EOL, $body)); $mail->Body = $body; $mail->AddAddress([EMAIL="info@blabla.nl"]info@blabla.nl[/EMAIL]); if (! $mail->Send()) { throw new Exception("Mailer Error: " . $mail->ErrorInfo, -5); } // E-mail sent correctly include_once 'bedankt.html'; } catch (Exception $e) { // There was a problem with the input parameters or on sending the e-mail include_once 'error.html'; }
Last edited by chrishirst; 04-23-2010 at 06:33 PM..
|