Page 1 of 1

contact form refuses to work, can anyone help?

Posted: Sun Sep 17, 2006 1:49 pm
by sambkk
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi I want to make a contact form but I am having some trouble.

I always use the same code for a simple form, but on a new site with a new host, it doesnt work.

I have no idea why. I turn CGI on already.

here is the code.

PHP file:

Code: Select all

<?

$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.peacefulseasangha.com/sampleforliz/files/CUT H.html">

<?

}

else {

print( "Error: Unknown error ocurred. The message could not be sent. Please try again later.\n");

}

?>
and here is the code from the html file:

Code: Select all

...

Contact FORM

</div>

<div id="cu">

Please use the form below to send us email. Thank You.

<div id="flabels">

<br>Name:

<br>Email:

<br>Comments:

</div>

<div id="fitems">

<br>

<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>

</div> ...
I use the exact same code on many sites but this new site it just doesnt work with it. Does anyone have any idea what could be the reason?
Trying to send to an email address on the domain.
I receive no email, no error msg, nothing.

Thanks.

Sami


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Sep 21, 2006 3:40 am
by Benjamin
When you submit the form, do you receive the, "Thank you for emailing us.Your file has been sent succesfully" message? Do you get a blank white page?

Your code is using short tags. I recommend changing all instances of <? to <?php. Your new host may have short tags disabled. Also, have a look at the mail example in the manual. Try that one out in a test file to see if it works. If it doesn't, contact your host. You may also want to have a look at swiftmailer.