Reply
Please Help With Simple Php Contact Form!
Old 04-16-2008, 10:23 PM Please Help With Simple Php Contact Form!
Junior Talker

Posts: 2
Name: dan
Hi All,

I'm sure you get this all a lot but I'm struggling to get a simple contact form to work. Here's the html side of things:

------------------------------------------------------------------------------------------------------------------

<form action="sendmail.php" method="post" name="ContactForm" id="ContactForm">
<div class="col1">
<div class="row">
<input name="name" type="text" class="input" id="name" value="Name:" />
</div>
<div class="row">
<input name="email" type="text" class="input" id="email" value="Email:" />
</div>
</div>
<div class="col2">
<div class="row1">
<textarea name="message" cols="1" rows="1" id="message">Message:</textarea>
<br />
<div class="div">
<input type="submit" name="submit" value="Submit" class="submit-button" />
</div>


------------------------------------------------------------------------------------------------------------------

which can be found at: http://www.stleonardshouse.co.uk/contact.html

now I have tried a hundred different php scrips to get this SIMPLE form to work, with no luck. I need the users name, email and message to be sent to email of enquiries@stleonardshouse.co.uk with the subject of 'Enquiry from St Leonard's House Website. If they dont enter an email I want it to display error.html and if its successful I need it to display thanks.html or something along those lines. Thats it! I'm not really worried about too much validation or spam protection or anything too complex, I just need something simple.

I was wondering if my server had anything to do with it and found this page on my hosts tech support pages:

http://www.fasthosts.co.uk/knowledge...?article_id=70


I do not have much experience with PHP scripting and I know someone out there could clear up this confusion for me in minutes with a simple script that I can upload and get this thing working once and for all!

Many thanks in advance,

DANIEL
dbh21 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 04-16-2008, 10:47 PM Re: Please Help With Simple Php Contact Form!
Webmaster Talker

Posts: 560
Daniel,
A common cause of contact forms not working is that the email address from which they are trying to be sent does not work as expected. As in, the email address is either A) not set up at all or B) not a server/domain email address (i.e. if your site is "www.hello.com" then a proper email address should be (set up already by you) hi@hello.com.

Matt
170 Designs is offline
Reply With Quote
View Public Profile
 
Old 04-18-2008, 11:43 AM Re: Please Help With Simple Php Contact Form!
Junior Talker

Posts: 2
Name: dan
Thanks but the email is set up correctly and working properly... the php code im trying to use is:

<?php

ini_set("sendmail_from", "enquiries@stleonardshouse.co.uk");

mail("enquiries@stleonardshouse.co.uk", "Enquiry From St Leonard's House Website",

$_POST['message'], "From"$_POST['email'], "Name"$_POST['name'] "-fenquiries@stleonardshouse.co.uk" );

header( "Location:http://www.stleonardshouse.co.uk/thanks.html" );

?>

but doesnt work. The hosting company states:

'In order for the script to work, you need to specify, via a fifth -f parameter, the domain from which the mail is being sent. The PHP component uses SMTP, and all Fasthosts' SMTP servers have filters which ensure that the data returned by either the first or fifth mail parameter relates to one of your domains hosted by Fasthosts. The final part of the script thanks the visitor for the message. This is done by sending an HTTP header back to the visitor's browser telling it to load a file called thankyou.html from your domain. The header function allows you to send any HTTP header back to the browser.

I'm not sure what is wrong here... please help!
Thanks
dbh21 is offline
Reply With Quote
View Public Profile
 
Old 04-19-2008, 03:23 PM Re: Please Help With Simple Php Contact Form!
Ultra Talker

Posts: 408
PHP Code:
<?php
if (!isset($_POST['email']) || $_POST['email'] == '')
{
    
header('Location: http://www.stleonardshouse.co.uk/error.html');
    die();
}
else
{
    
mail('enquiries@stleonardshouse.co.uk'"Enquiry From St Leonard's House Website"$_POST['message'], null'-f' $_POST['email']);
    
header('Location: http://www.stleonardshouse.co.uk/thanks.html');
    die();
}
?>
Try that.
Lucas3677 is offline
Reply With Quote
View Public Profile Visit Lucas3677's homepage!
 
Reply     « Reply to Please Help With Simple Php Contact Form!
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12521 seconds with 13 queries