0

I use the HTML page and need help to fix the contact form on an page. The page contain Greek characters and allso need to use in the contact form. so... This is my currently 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 you for the message. We will contact you shortly.');
    window.location = 'index.html';
</script>
<?php
}
else { ?>
    <script language="javascript" type="text/javascript">
        alert('Message failed. Please, send an email to info@mydomain.gr');
        window.location = 'el/CEB5CF80CEB9CEBACEBFCEB9CEBDCF89CEBDCEB9CEB1/MS_1.html';
    </script>
<?php
}
?>

and I got that form code in the 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 :(

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • 1
    So what is the problem?? ___and it's not working___ _Not very helpful_ – RiggsFolly Jun 28 '16 at 11:20
  • `language="javascript"` is deprecated and should not be used – RiggsFolly Jun 28 '16 at 11:23
  • I don't know guys... i'm newb, I just getting and code and trying to edit it with my knowlage. as for "not working" it sends me to the page that tells me that "The page is not working" – Vadim Sert Jun 28 '16 at 11:34
  • What is being reported in your `php error log` – RiggsFolly Jun 28 '16 at 11:34
  • **Debugging Lesson 1** Add [error reporting](http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php/845025#845025) to the top of your file(s) _while testing_ right after your opening PHP tag for example ` – RiggsFolly Jun 28 '16 at 11:36

1 Answers1

1

You are not provided dot in this line $body_message .= 'For ' $field_subject."\n"; (in between For and $field_subject )

So just provide the dot concatenation like this $body_message .= 'For '.$field_subject."\n";

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Mani
  • 2,675
  • 2
  • 20
  • 42