Hey Gents,
Here is my Issue, i’m getting an error trying to get my form to submit and send emails. The development site is at [url]www.marinetechegypt.com/contact.php
I tried it locally on my WAMP first, it wasn’t sending so i decided to test on the server incase its a local config issue.
I just get an error from the If condition for if(isset($_POST[‘submit’])) {]. Im really trying my best to solve this but i’m not sure what i’m missing! any help would be greatly appreciated, thx ?
The HTML:
[code=html] <div class=”col one-half”>
<h3> Send us an Email </h3>
<div class=”ajax_message”></div>
<form class=”contact-form” method=”post” action=”php-mailer.php”>
<input type=”hidden” name=”ac” value=”login” />
<p>
<label for=”fname”> Your Name <span class=”required”> * </span> </label>
<input type=”text” name=”fname” class=”input-short” id=”fname” placeholder=”Your Full Name” />
<?php if(isset($errName1)) echo $errName1; ?>
</p>
<p>
<label for=”email”> Your Email <span class=”required”> * </span> </label>
<input type=”text” name=”email” class=”input-long” id=”email” placeholder=”Your Email” />
<?php if(isset($errEmail)) echo $errEmail; ?>
</p>
<p>
<label> Subject </label>
<input name=”subject” type=”text” id=”subject” class=”input-short” placeholder=”Subject”/>
</p>
<p>
<label for=”message”> Your Message <span class=”required”> * </span> </label>
<textarea name=”message” class=”textarea-message” id=”textarea” placeholder=”Your Message”></textarea>
<?php if(isset($errMessage)) echo $errMessage; ?>
</p>
<p><input name=”submit” type=”submit” value=”Send Message” class=”button small grey contact-submit” /></p>
</form>
<div class=”error-container” style=”display:none;”> Please fill the above required fields correctly! </div>
</div>
phpmailer file: are there missing dependencies for this php function or what? Ive changed the adressed to hide the emails and such
[CODE]<?php
if(isset($_POST[‘submit’])) {
$to = “[email protected]”;
$subject = “Marinetech Egypt Contact Form”;
$first_name_field = $_POST[‘fname’];
$email_field = $_POST[’email’];
$message = $_POST[‘textarea’];
$message = ‘<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head></head>
<body>
<table>
<tr><td>Name</td><td>’ . $first_name_field . ‘</td></tr>
<tr><td>Email</td><td>’ . $email_field . ‘</td></tr>
<tr><td>Website</td><td>’ . $subject . ‘</td></tr>
<tr><td>Comment</td><td>’ . nl2br($message) . ‘</td></tr>
</table>
</body>
</html>’;
$headers = ‘MIME-Version: 1.0’ . “rn”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “rn”;
// Additional headers
$headers .= ‘To: <[email protected]>’ . “rn”;
$headers .= ‘[From] <[email protected]>’ . “rn”;
// Mail it
ini_set(‘SMTP’,’mbox.freehostia.com’);
ini_set(‘smtp_port’,’25’);
// ini_set(‘username’ , ‘[email protected]’);
// ini_set(‘password’ , ‘XXXXXXXX’);
// ini_set(‘sendmail_from’,’[email protected]’);
mail($to, $subject, $message, $headers);
include(‘index.html’);
} else {
echo “Error”;
}
?>