Search the Community
Showing results for tags 'php form'.
-
Hi heres the form to take a look http://jamaicainn.com/contact.php the contact form basically is now sending all the information to the database of our external partner. I have a field "Regarding" which when selected the form information goes to the respected departments for ex., Spa goes to [email protected] heres the code I wrote. which doesnt seem to work <?php if ($regarding == 'Human Resources'){ // form action email([email protected], $subject, $message) then redirect to } elseif ($regarding == 'Guest Relations'){ // form action email([email protected]@jamaicainn.com, $subject, $message) } elseif ($regarding == 'Spa'){ // form action email([email protected], $subject, $message) } elseif ($regarding == 'Marketing'){ // form action email([email protected], $subject, $message) }elseif ($regarding == 'Accounts'){ // form action email([email protected], $subject, $message) } elseif ($regarding == 'Reservations') { // form action post(http://www.NavisTechnologies.info/Narrowcast2005/ELM/ELMContactPost.aspx) } ?> <p><form name="form1" method="post" action="http://www.NavisTechnologies.info/Narrowcast2005/ELM/ELMContactPost.aspx"> <table width="90%" border="0" cellpadding="3" cellspacing="3"> <tr> <td width="30%"> <input name="account" value="15340" type="hidden" /> <label for="FirstName">First name*</label></td> <td><input type="text" name="FirstName" id="FirstName" required></td> </tr> <tr> <td><label for="LastName">Last name*</label></td> <td><input type="text" name="LastName" id="LastName" required></td> </tr> <tr> <td><label for="EmailAddress">Email*</label></td> <td><input type="email" name="EmailAddress" id="EmailAddress" required></td> </tr> <tr> <td><label for="HomePhone">Phone</label></td> <td><input type="tel" name="HomePhone" id="HomePhone"></td> </tr> <tr> <td><label for="regarding">Regarding</label></td> <td><select name="regarding" id="regarding"> <option><p> Reservations</p></option> <option><p> Guest Relations</p></option> <option><p> Spa</p></option> <option><p> Marketing</p></option> <option><p> Human Resources</p></option> <option><p> Accounts</p></option> <option><p> Groups/Weddings</p></option> </select></td> </tr> <tr> <td><label for="CheckInDate">Check in date</label></td> <td><input name="CheckInDate" type="Date" id="CheckInDate"><a href="javascript:openCalendar('CheckInDate')"><img src="http://jamaicainn.com/calendar.gif" width="20" height="20" border="0" /></a></td> </tr> <tr> <td><label for="CheckOutDate">Check out date</label></td> <td><input name="CheckOutDate" type="Date" id="CheckOutDate"><a href="javascript:openCalendar('CheckOutDate')"><img src="http://jamaicainn.com/calendar.gif" width="20" height="20" border="0" /></a></td> </tr> <tr> <td><label for="Date">Comments</label></td> <td><textarea name="Message" id="Message" cols="30" rows="4"></textarea></td> </tr> <tr> <td> </td> <td><input name="send" type="submit" class="submit" id="send" value="SUBMIT"></td> </tr> </table> </form> <script language="javascript" type="text/javascript"> function openCalendar(FormElement){ var calendarwindow; url = "calendar.html?formname=form1&formelement=" + FormElement; calendarwindow = window.open(url,"calendar","toolbar=no,width=200,height=144,top=50,left=50,status=no,scrollbars=no,resize=no,menubar=no"); calendarwindow.focus(); } </script> Any helps appreciated Thanks
-
Hey everyone, I purchased a template to make a website with and need a little bit of help with altering the contact form. The form works fine, when someone fills out the form online and the email comes to me, the reply to email address is the one they inputted into the form. However, when I click "reply" in the email, it changes to my email address(the $fromEmail which I was trying to override) Here is the send.php <?php $ajax = (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); $ajax = true; //we do not allow direct script access if (!$ajax) { //redirect to contact form echo "Please enable Javascript"; exit; } require_once "config.php"; //we set up subject $mail->Subject = isset($_REQUEST['email_subject']) ? $_REQUEST['email_subject'] : "Message from site"; //let's validate and return errors if required $data = $mail->validateDynamic(array('required_error' => $requiredMessage, 'email_error' => $invalidEmail), $_REQUEST); //let's make sure we have valid data //if (!$data['errors'] && (!isset($_REQUEST['js']) || $_REQUEST['js'] != 1)) { //$data['errors']['global'] = 'Javascript is required. Please try again'; //} if ($data['errors']) { echo json_encode(array('errors' => $data['errors'])); exit; } //force to overwrite email address $mail->SetFrom($data['fields']['Email'], $data['fields']['Name'].' '.$data['fields']['Surname']); $html = '<body style="margin: 10px;"> <div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;"> <h2>' . $mail->Subject . '</h2> '; foreach ($data['fields'] as $label => $val) { $html .= '<p>' . $label . ': ' . $val . '</p>'; } $html .= '</div></body>'; $mail->setup($html, $_REQUEST, array()); $result = array('success' => 1); if (!$mail->Send()) { $result['success'] = 0; } echo json_encode($result); exit; config.php <?php /** * Setup mail server config */ ini_set('display_errors', 0); //where we would like to send email $recipientEmail = '[email protected]'; $recipientName = 'The Touchmark'; //Address which will be visible in "From" field $fromEmail = '[email protected]'; $fromName = 'Site Admnistrator'; //Validation error messages $requiredMessage = 'Field is required'; $invalidEmail = 'Invalid email'; /** * Advanced configuration - no need to modify */ require_once(dirname(__FILE__) . '/vendor/ctPHPMailer.php'); $mail = new ctPHPMailer(); //set your email address $mail->AddAddress($recipientEmail, $recipientName); $mail->SetFrom($fromEmail, $fromName); $debug = false; //if problems occur, set to true to view debug messages I do not know much about php so I am not sure what to do to make it stay as the users email address when they click "reply" on the email. Any ideas would be great.