Hello Everyone!
I would be very grateful if you could shed some light on why my index is not passing the correct information to my script. To the best of my knowledge I know the mailer script works but I shall post the code related from both files below for your perusal.
Any help would be much appreciated as it’s been a long day in the office with testing and I’m out of ideas!
Code below is from the (mailer.php file):
.style1 { text-align: center; } .style2 { border-width: 0px; } .auto-style1 { color: #FFFFFF; } .auto-style2 { text-align: center; color: #FFFFFF; } <?php if(isset($_POST['Submit'])) { $to = "[email protected]"; $subject = "Online Enquiry from Supreme-IT Website"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message_field = $_POST['message']; $body = "Name: $name_field\n E-Mail Address: $email_field\n Message:\n $message_field\n"; echo "Thank you! We have received your Online Enquiry!"; mail($to, $subject, $body); } else { echo "error: no data sent!"; } ?>Thanks for your enquiry!
We aim to respond to all online enquiries within 24hrs
AND the code below is a section of the related area taken from (index.html):
<div class="section section_with_padding" id="contact">
<h2>Contact</h2>
<div class="half left">
<h4>Quick Contact Form</h4>
<p>Got a question for us? Need a quote? simply fill in the form below and we'll get back to you as soon as we can.</p>
<div id="contact_form">
<form method="post" name="contact_form" action="mailer.php">
<div class="left">
<label for="name">Name:</label> <input name="name" type="text" class="input_field" id="name" maxlength="40" />
</div>
<div class="right">
<label for="email">Email:</label> <input name="email" type="text" class="input_field" id="email" maxlength="40" />
</div>
<div class="clear"></div>
<label for="message">Message:</label> <textarea id="message" name="text" rows="0" cols="0"></textarea>
<input type="submit" class="submit_btn float_l" name="Submit" id="submit" value="Send" />
</form>
</div>
</div>
I have tested it online and this is what is happening:
- Everything is working to which a customer should see, i.e. filling details in the contact form Name, Email and Message and when clicking send, it takes you to the thanks page/we will response within 24hrs.
However the information which is typed into the index file (Name, Email and Message) is not being sent to the specified email address.
Can anyone see where I am going wrong, I believe it’s got something to do with the way I have setup the parameters in the index file…
- I have used this script before in the past with a different index file, slightly similar code, however it’s been a few years and I’m a bit rusty.
Any help or advice would be greatly appreciated, as I thought I’d ask professionals.
Thanks in advance
Fraz