im new to PHP, and I created a page called contact.php and there is a simple contact-us form in it.
The form works successfully in localhost, but on the website it doesn't. The form itself looks good but I don't recieve any mail after i fill a form. What can be the reason? I don't know if this is matter but i placed the php before all of the html. you can see the form in this address: http://tevachocolate.myartsonline.com/contact.php
Here's the code: (I replaced my mail with *****)
PHP
<?php
if($_POST["submit"]) {
$recipient="******@gmail.com";
$subject="התקבל טופס מאתר ׳טבע השוקולד׳";
$sender=$_POST["sender"];
$senderEmail=$_POST["senderEmail"];
$senderPhone=$_POST["senderPhone"];
$message=$_POST["message"];
$mailBody="שם: $sender\n אימייל: $senderEmail\n טלפון: $senderPhone\n\n הודעה:$message";
mail($recipient, $subject, $mailBody, "From: justadress@mine.com");
$thankYou="<p>תודה רבה! פנייתך התקבלה.</p>";
}
?>
and the form:
HTML
<form method="post" action="contact.php" class="tofes">
<label>שם מלא:</label>
<input name="sender">
<label>כתובת אימייל:</label>
<input name="senderEmail">
<label>טלפון:</label>
<input name="senderPhone">
<label>הודעה:</label>
<textarea rows="5" cols="20" name="message"></textarea>
<br>
<input type="submit" name="submit" value="שליחה">
<?=$thankYou ?>
</form>