[SOLVED] PHP contact form problem

This is a discussion on "[SOLVED] PHP contact form problem" within the PHP Forum section. This forum, and the thread "[SOLVED] PHP contact form problem are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 24th, 2008, 20:23
Junior Member
Join Date: Nov 2007
Location: serbia
Age: 23
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] PHP contact form problem

Hi,
i copy PHP contact form from one site but form aint work
It isn't send mails at all.
Here is a code snippet:

Code: Select all
<form method="post" action="sendeail.php">

<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />


<span class="formica">Name:</span> <br />
<input type="text" name="visitor" size="35" />
<br />
<span class="formica">Mail:</span><br />
<input type="text" name="visitormail" size="35" />
<br /> <br />
<br />
<span class="formica">Client:</span><br />
<select name="attn" size="1">
<option value=" nix ">Client 1  </option> 
<option value=" Technical Support ">Client 2 </option> 
<option value=" Webmaster ">Client 3</option> 
</select>
<br /><br />
<span class="formica">Mail Message:</span>
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
<br />
</form>
and php script:

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>contact  </title>
</head>
<body>

<!-- Reminder: Add the link for the 'next page' (at the bottom) --> 
<!-- Reminder: Change 'YourEmail' to Your real email --> 

<?php

$ip = $_POST['ip']; 
$httpref = $_POST['httpref']; 
$httpagent = $_POST['httpagent']; 
$visitor = $_POST['visitor']; 
$visitormail = $_POST['visitormail']; 
$notes = $_POST['notes'];
$attn = $_POST['attn'];


if (eregi('http:', $notes)) {
die ("wrong entry! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
{
echo "<h2>Vratite se nazad - Unesite ispravan MAIL</h2>\n"; 
$badinput = "<h2>Error</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Go back</h2>\n";
die ("error! ! "); 
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ; 
$subject = $attn; 

$notes = stripcslashes($notes); 

$message = " $todayis [EST] \n
Primalac: $attn \n
Poruka: $notes \n 
Poslao: $visitor ($visitormail)\n
Dodatni info: IP = $ip \n
Browser : $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("blokodex@gmail.com", $subject, $message, $from);

?>

<p align="center">
Date: <?php echo $todayis ?> 
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) 
<br />

Attention: <?php echo $attn ?>
<br /> 
Message:<br /> 
<?php $notesout = str_replace("\r", "<br/>", $notes); 
echo $notesout; ?> 
<br />
<?php echo $ip ?> 

<br /><br />
<a href="kontakt.php"> Next Page </a> 
</p> 

</body>
</html>
Reply With Quote

  #2 (permalink)  
Old Jan 24th, 2008, 21:58
Aso's Avatar
Aso Aso is offline
Chief Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,012
Blog Entries: 2
Thanks: 5
Thanked 23 Times in 20 Posts
Send a message via Skype™ to Aso
Re: PHP contact form problem

Is your server capable of running PHP scripts?
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Reply With Quote
  #3 (permalink)  
Old Jan 25th, 2008, 05:36
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: PHP contact form problem

I think your error could be here:
PHP: Select all

<form method="post" action="sendeail.php"
Are you sure it's supposed to say "sendeail.php" and not "sendmail.php" or somethinglike that....
Reply With Quote
  #4 (permalink)  
Old Jan 25th, 2008, 08:10
Junior Member
Join Date: Nov 2007
Location: serbia
Age: 23
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP contact form problem

Name of my script is sendeail.php so that is not a error

Quote:
Is your server capable of running PHP scripts?
Of course. For example my PHP gallery works just fine, but contact form nope
Reply With Quote
  #5 (permalink)  
Old Jan 27th, 2008, 04:53
New Member
Join Date: Nov 2005
Location: Canada
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP contact form problem

Check your web hosting provider whether they allow to send email or post your error message.
Reply With Quote
  #6 (permalink)  
Old Jan 27th, 2008, 05:11
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP contact form problem

Is the PHP script really named sendeail.php?

Wouldn't it be sendmail.php?
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #7 (permalink)  
Old Jan 27th, 2008, 09:08
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: PHP contact form problem

You entered the right email? Simple things like that are easy to miss.
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #8 (permalink)  
Old Jan 29th, 2008, 08:45
Junior Member
Join Date: Nov 2007
Location: serbia
Age: 23
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP contact form problem

Yes name of pHP script is sendeail.php.

And yes i put right e mail address
I have no errors or warnings.
Reply With Quote
  #9 (permalink)  
Old Jan 29th, 2008, 15:00
Aso's Avatar
Aso Aso is offline
Chief Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,012
Blog Entries: 2
Thanks: 5
Thanked 23 Times in 20 Posts
Send a message via Skype™ to Aso
Re: PHP contact form problem

I think you're going to have to give a few more details of what exactly is your problem, otherwise this'll go on forever!

What *exactly* do you mean by 'it doesn't work'?

Do you get a 404?

Do you get a blank page?

Does it appear as if everything works, but you don't get an email?

Have you tried using another email address (some hosts can have interfering spam filters)?
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Reply With Quote
  #10 (permalink)  
Old Jan 29th, 2008, 18:43
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: PHP contact form problem

You could check by using some PHP code. Replace:
PHP: Select all

mail("blokodex@gmail.com"$subject$message$from); 

With:
PHP: Select all

if (mail("blokodex@gmail.com"$subject$message$from)) {
echo 
'Everything went ok';
} else {
echo 
'Problem';

I'm sure there is a way for PHP to tell us the exact problem but not sure how.
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #11 (permalink)  
Old Jan 30th, 2008, 11:36
Junior Member
Join Date: Nov 2007
Location: serbia
Age: 23
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP contact form problem

The problem was with free mail acc like gmail/yahoo. I dont know why ;/
Tnx and sry guyz
Reply With Quote
  #12 (permalink)  
Old Jan 30th, 2008, 16:16
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: [SOLVED] PHP contact form problem

Your host might have blocked it because it thought it was Spam. Check your junk/spam folder.
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #13 (permalink)  
Old Jan 31st, 2008, 17:56
Junior Member
Join Date: Nov 2007
Location: serbia
Age: 23
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] PHP contact form problem

That was first on my mind , but spam folder was empty
Nevermind and tnx again.
Reply With Quote
Reply

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] PHP contact form redirect to same form Posie PHP Forum 14 Jan 29th, 2008 20:28
[SOLVED] How to Validate a HTML Contact Form Xhmtl Web Page Design 2 Dec 9th, 2007 20:11
[SOLVED] PHP Contact Form Stuart PHP Forum 8 Dec 4th, 2007 17:42
[SOLVED] Contact Form Help danny322 PHP Forum 3 Nov 7th, 2007 16:05
[SOLVED] PHP Contact Form Stuart PHP Forum 9 Oct 20th, 2007 00:48


All times are GMT. The time now is 20:45.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43