PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ched53
Forum Newbie
Posts: 3 Joined: Wed Feb 25, 2009 12:01 pm
Post
by ched53 » Wed Feb 25, 2009 12:04 pm
This has been such a nightmare. I am a complete newbie with PHP. I want the enquiry form (
http://www.hairbykirbyblythe.co.uk/enquiries.h ... to email the results to my clients account. I've followed all the information on the fasthosts helpdesk and still it doesn't work. Below is the code for my form and the PHP I added, can someone please tell me where I have gone wrong?
Code: Select all
<form method='post' action='sendmail.php'>
<label>Name:</label><p><input name="Name:" type="text" size="50" maxlength="50" /></p>
<label>Telephone Number:</label> <p><input name="telephone" type="text" size="50" maxlength="20" /></p>
<label>Email:</label><p><input name="email" type="text" size="50" maxlength="25" /></p>
<label>Enquiry:</label><p><textarea name="enquiry" cols="90" rows="12"></textarea></p>
<input type='submit' />
<input type="reset" />
</label></form>
<?php
ini_set("sendmail_from", " kirby@hairbykirbyblythe.co.uk ");
mail($email_to, $email_subject, $email_message, $headers, '-fkirby@hairbykiryblythe.co.uk');
?>
<?php
ini_set('sendmail_from', $email_from);
$email_to = "kirby@hairbykirbyblythe.co.uk";
$name =$_POST['Name'];
$email_from =$_POST['email'];
$email_subject = "Enquiry";
$comments = $_POST['message'];
$headers =
"From: $email_from .\n";
"Reply-To: $email_from .\n";
$message= "Name: ". $name . "\ntelephone: " . $telephone; "\nemail: " . $email;
$sent = mail($email_to, $email_subject, $message, $headers, '-f .$email_from');
if ($sent)
{
header( "Location: http://www.hairbykirbyblythe.co.uk" );
} else {
/* If there is an error display an error message */
echo 'There has been an error sending your enquiry. Please try later.';
}
?>
Last edited by
ched53 on Thu Feb 26, 2009 2:41 am, edited 1 time in total.
Citizen
Forum Contributor
Posts: 300 Joined: Wed Jul 20, 2005 10:23 am
Post
by Citizen » Wed Feb 25, 2009 4:09 pm
Are you receiving an error?
Also, use
when posting php code on the boards.
ched53
Forum Newbie
Posts: 3 Joined: Wed Feb 25, 2009 12:01 pm
Post
by ched53 » Thu Feb 26, 2009 2:40 am
sorry, all I am getting simply a 'page not found'
This is all way over my head so I'd appreciate it if someone could shed some light on this. I posted exactly the same thing on my yahoo answers account and I've have so many responses but every single one is different, so its hard to know which one is right
Paul Arnold
Forum Contributor
Posts: 141 Joined: Fri Jun 13, 2008 10:09 am
Location: Newcastle Upon Tyne
Post
by Paul Arnold » Thu Feb 26, 2009 5:18 am
Cut and paste the following,
Code: Select all
<?php
ini_set("sendmail_from", " kirby@hairbykirbyblythe.co.uk ");
mail($email_to, $email_subject, $email_message, $headers, '-fkirby@hairbykiryblythe.co.uk');
?>
<?php
ini_set('sendmail_from', $email_from);
$email_to = "kirby@hairbykirbyblythe.co.uk";
$name =$_POST['Name'];
$email_from =$_POST['email'];
$email_subject = "Enquiry";
$comments = $_POST['message'];
$headers =
"From: $email_from .\n";
"Reply-To: $email_from .\n";
$message= "Name: ". $name . "\ntelephone: " . $telephone; "\nemail: " . $email;
$sent = mail($email_to, $email_subject, $message, $headers, '-f .$email_from');
if ($sent)
{
header( "Location: http://www.hairbykirbyblythe.co.uk" );
} else {
/* If there is an error display an error message */
echo 'There has been an error sending your enquiry. Please try later.';
}
?>
Into a php file called 'sendmail.php'.
ched53
Forum Newbie
Posts: 3 Joined: Wed Feb 25, 2009 12:01 pm
Post
by ched53 » Thu Feb 26, 2009 5:59 am
Well thats stopped me getting the 'page not found', its now doing what I asked and going back to the homepage when you click the submit button.
BUT I'm not receiving any emails
So stressful. Please pardon my lack of knowledge on this topic