php - How to fix the contact form -
i use html page , need fix contact form on page. page contain greek characters , allso need use in contact form. so... php code
<?php $field_name = $_post['lastname']; $field_email = $_post['email']; $field_message = $_post['yourmessage']; $field_subject = $_post['select']; $field_state = $_post['perioxi']; $field_phone = $_post['phone']; $mail_to = 'info@mydomain.gr'; $subject = 'from: '.$field_name; $body_message = 'from: '.$field_name."\n"; $body_message .= 'for ' $field_subject."\n"; $body_message .= 'perioxi: '.$field_state."\n"; $body_message .= 'phone: '.$field_phone."\n"; $body_message .= 'e-mail: '.$field_email."\n"; $body_message .= 'message: '.$field_message; $headers = 'from: '.$field_email."\r\n"; $headers .= 'reply-to: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('thank message. contact shortly.'); window.location = 'index.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('message failed. please, send email info@mydomain.gr'); window.location = 'el/ceb5cf80ceb9cebacebfceb9cebdcf89cebdceb9ceb1/ms_1.html'; </script> <?php } ?>
and got form code in page:
<form id="formular" action="/contacts.php" method="post"> <fieldset> <input type="hidden" name="$formname$" value="mdbformgeneric" /> <input type="hidden" name="$formaction$" value="επικοινωνια/" /> <input type="hidden" name="$origin$" value="el/ceb5cf80ceb9cebacebfceb9cebdcf89cebdceb9ceb1/" /> <h2>Ζητήστε προσφορά για τη δική σας μόνωση</h2> <p>Συμπληρώστε την παρακάτω φόρμα και ζητήστε προσφορά για κάθε τύπο μόνωσης.</p> </fieldset> <fieldset> <legend>Όνομα </legend> <ul> <li><label for="mdbformgeneric_firstname">Όνομα <span>*</span> </label> <input id="mdbformgeneric_firstname" type="text" maxlength="50" size="14" name="firstname" value="" /> </li> <li><label for="mdbformgeneric_lastname">Επίθετο <span>*</span> </label> <input id="mdbformgeneric_lastname" type="text" maxlength="50" size="28" name="lastname" value="" /> </li> </ul> </fieldset> <fieldset> <legend>Επιλέξτε κατιγορία</legend> <ul> <li> <label>Επιλέξτε κατιγορία</label> <select name="select"> <option value="monosi">Θερμομόνωση</option> <option value="steganopoiisi">Στεγανοποίηση</option> </select> </li> <li> <label>Περιοχή</label> <input type="text" maxlength="50" size="25" name="perioxi" value="" /> </li> </ul> <fieldset> <legend>Επικοινωνία</legend> <ul> <li><label for="mdbformgeneric_phone">Τηλέφωνο</label> <input id="mdbformgeneric_phone" type="text" maxlength="50" size="25" name="phone" value="" /> </li> <li><label for="mdbformgeneric_email">e-mail <span>*</span> </label> <input id="mdbformgeneric_email" type="text" maxlength="200" size="53" name="email" value="" /> </li> <li><label for="mdbformgeneric_yourmessage">Το μήνυμά σας</label> <textarea name="yourmessage" id="mdbformgeneric_yourmessage" cols="52" rows="10"></textarea> </li> </ul> </fieldset> <fieldset> <ul class="mdb_form_submit"> <li> <input type="submit" class="btn_absenden" title="Αποστολή " name="submit" value="Αποστολή " /> </li> </ul> </fieldset> </form>
and it's not working :(
you not provided dot in line $body_message .= 'for ' $field_subject."\n";
(in between for
, $field_subject
)
so provide dot concatenation $body_message .= 'for '.$field_subject."\n";
Comments
Post a Comment