IPB

Welcome Guest ( Log In | Register )


Welcome Guest, Register to Remove this Message!
 
Reply to this topicStart new topic
> php email contact form script -for apache server, Hi could anyone help me fix my contact form script
sambkk
post Sep 14 2006, 05:59 PM
Post #1


Newbie
*

Group: Members
Posts: 39
Joined: 26-March 06
Member No.: 1345



Hi guys
I am hoping you could give mesome help and tell me what I have to change in my email contact form.

I get this msg when I try my contact form.

The server encountered an unexpected condition which prevented it from fulfilling the request.
The script had an error or it did not produce any output. If there was an error, you should be able to see it in the error log.


the server seems to be apache.

my code for the form is this:

<form name="form1" method="post" action="mail_t.php">

<input type="text" name="user" size="25">
<input type="text" name="emailaddress" size="25">
<textarea cols="10" rows="4" name="comments"></textarea>
<input type="submit" value="Send">
</form>

and my mail_t.php looks like this:
(the email adress removed as its not mine)

<?
$to = "xxx@xxxx.com";
$subject = "Email from website contact form";
$boundary = uniqid("");
$headers = "From: $from";
$body = "
Name :$user
Email :$emailaddress
Comment :$comments
";

if (mail($to, $subject, $body,$headers)) {
print( "Thank you for emailing us.Your file has been sent succesfully");
?>
<meta http-equiv=refresh content="1;URL=http://www.peacefulsangha.com/files/CUTH.html">
<?
}
else {
print( "Error: Unknown error ocurred. The message could not be sent. Please try again later.\n");
}

?>

the link to the page is here:

http://www.peacefulseasangha.com/sampleforliz/files/CU.html

I am lost as I dont really know php, this script has worked before on other servers.

thanks

sami


--------------------
Go to the top of the page
 
+Quote Post
Joe
post Sep 15 2006, 06:15 AM
Post #2


* legend *
Group Icon

Group: Moderators
Posts: 5166
Joined: 31-January 04
From: The Valleys
Member No.: 8



From what I can see, the only problem is that you are not sending any data.

Use $_GET to retreive the information from the form and store it in a variable to send.

[php]
$user = $_GET['user'];
$emailaddress = $_GET['emailaddress'];
$comments = $_GET['comments'];
[/php]

like so.


--------------------
[http://www.joe2torials.com/] Your guide to (X)HTML, CSS, PHP, ASP, Photoshop, Web Management, Accessibility, Standards, Semantics and much more...
[http://www.rough-draft.co.uk/] My NEW webdesign portfolio.

Read my Weblog.
Go to the top of the page
 
+Quote Post
sambkk
post Sep 15 2006, 07:56 AM
Post #3


Newbie
*

Group: Members
Posts: 39
Joined: 26-March 06
Member No.: 1345



hi joe thanks for the help.
unfortunately it didnt work.

here is what my mail_t.php file looks like now:


<?
$to = "xxx@xxxx.com";
$subject = "XXXEmail from website contact form";
$boundary = uniqid("");
$headers = "From: $from";
$body = "
Name :$_GET['user'];
Email :$_GET['emailaddress'];
Comment :$_GET['comments'];
";

if (mail($to, $subject, $body,$headers)) {
print( "Thank you for emailing us.Your file has been sent succesfully");
?>
<meta http-equiv=refresh content="1;URL=http://www.peacefulseasangha.com/sampleforliz/files/CUTH.html">
<?
}
else {
print( "Error: Unknown error ocurred. The message could not be sent. Please try again later.\n");
}

?>

perhaps I didnt follow your instructions carefully enough?

sami


--------------------
Go to the top of the page
 
+Quote Post
Joe
post Sep 15 2006, 05:55 PM
Post #4


* legend *
Group Icon

Group: Moderators
Posts: 5166
Joined: 31-January 04
From: The Valleys
Member No.: 8



Not quite right, I recommend you take a look at a script I wrote out a while back, it may be of some help to you.

http://forum.weborum.com/index.php?showtopic=3853


--------------------
[http://www.joe2torials.com/] Your guide to (X)HTML, CSS, PHP, ASP, Photoshop, Web Management, Accessibility, Standards, Semantics and much more...
[http://www.rough-draft.co.uk/] My NEW webdesign portfolio.

Read my Weblog.
Go to the top of the page
 
+Quote Post
sambkk
post Sep 15 2006, 06:53 PM
Post #5


Newbie
*

Group: Members
Posts: 39
Joined: 26-March 06
Member No.: 1345



thanks joe,
I'll have a look.

Sami


--------------------
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



Lo-Fi Version
Euribor
Reviews
Time is now: 9th September 2010 - 08:19 PM