Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Contact form not sending
Old 05-30-2008, 05:53 PM Contact form not sending
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
I wrote a contact form for a guy, and its not working. Can someone see why?? Because I can't

Code:
<form name="contact" method="post" action="send.php">
   <table width="100%" border="0">
         <tr>
       <td>E-Mail:</td>
       <td><input type="text" name="email"  /></td>
     </tr>
     <tr>
       <td>Subject:</td>
       <td><input type="text" name="subject" /></td>
     </tr>
     <tr>
       <td>Message:</td>
       <td><textarea name="message" cols="30" rows="10"></textarea></td>
     </tr>
    <tr> <td></td><td><input type="submit" value="Send E-Mail" /></td></tr>
   </table>   </form>
and the send.php page

PHP Code:
<?php 

$email 
$_POST['email'];
$subject $_POST['subject'];
$message $_POST['message'];

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../css/style.css" />
<title>Gaming Info :: Contact Us</title>
<style type="text/css">
<!--
.style2 {
    font-size: 18px
}
-->
</style>
</head>

<body><div id="header"></div>
<div id="nav">
  <ul>
 <li><a href="../index.html">Home</a></li> 
   <li><a href="../reviews">Reviews</a></li>
   <li><a href="../dates">Release Dates</a></li>
   <li><a href="../contact">Contact Us</a></li>
 
 
  </ul>
</div>

<div id="content">
 <div class="left-col"> <p class="style1 style2"><strong>Contact Us</strong></p>
   
  <?php 
  
if(empty($email) || empty($message) || empty($subject) || !strstr($email,"@") || !strstr($email,".")) {
echo 
'<p class="error">Please fill in all fields correctly.</p>';
die (
'  <form name="contact" method="post" action="send.php">
   <table width="100%" border="0">
         <tr>
       <td>E-Mail:</td>
       <td><input type="text" name="email"  /></td>
     </tr>
     <tr>
       <td>Subject:</td>
       <td><input type="text" name="subject" /></td>
     </tr>
     <tr>
       <td>Message:</td>
       <td><textarea name="message" cols="30" rows="10"></textarea></td>
     </tr>
    <tr> <td></td><td><input type="submit" value="Send E-Mail" /></td></tr>
   </table>   </form></div>
   <div class="right-col"> <p class="style1">Right</p>
     <p class="style1">Column</p>
     <p class="style1">Stuff </p>
     <p class="style1">Goes </p>
     <p class="style1">Here</p>
     <p class="style1">?</p>
     <p class="style1">?</p>
     <p class="style1">?</p>
     <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p></div>
  <br style="clear:both" />
</div>
</body>
</html>
'
);

}
      
$from "From: $email\r\n";
mail("email@host.co.uk"$subject$message$from); 
?>


  <p>Thank you, your E-Mail has been sent.</p>
  
  </div>
   <div class="right-col"> <p class="style1">Right</p>
     <p class="style1">Column</p>
     <p class="style1">Stuff </p>
     <p class="style1">Goes </p>
     <p class="style1">Here</p>
     <p class="style1">?</p>
     <p class="style1">?</p>
     <p class="style1">?</p>
     <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p></div>
 <div align="center"><br style="clear:both" />
     Design by <a href="http://www.sgilligan.co.uk">SGilligan.co.uk</a></div>
</div>
</body>
</html>
if you want to test. You have to change the e-mail in the script

Thanks
__________________

Please login or register to view this content. Registration is FREE
Gilligan is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-30-2008, 08:48 PM Re: Contact form not sending
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
It looks ok to me too. Does the send.php page load and it's just not sending the email or does it never get to send.php? What exactly happens when you submit the form.

You might try using ids instead of names. I'm not sure it will matter, but you should be using ids instead of names anyway so why not.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-31-2008, 07:16 AM Re: Contact form not sending
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
What do you mean IDs instead of names?

What happens is you click 'Send E-Mail' and send.php loads, it says message sent (or whatever).

I remember trying this on my server and it worked, I've got PHP 5, and this guy has PHP 4. Maybe that's the problem?
__________________

Please login or register to view this content. Registration is FREE
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 05-31-2008, 11:24 AM Re: Contact form not sending
Extreme Talker

Posts: 177
Trades: 0
What exactly isn't working? Did they check the junk mail folder?
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 05-31-2008, 12:33 PM Re: Contact form not sending
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
I used my e-mail to test.

On their server no e-mail is received

On my server (exact same code) the e-mail is received.

So it must be the PHP version or something

I also cleaned up my code a lot and no change
__________________

Please login or register to view this content. Registration is FREE
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 05-31-2008, 02:31 PM Re: Contact form not sending
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
Try removing the \r from $from (or really try removing \r\n since it's only needed to separate extra headers) if removing \r or \r\n doesn't work try removing $from completely.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 05-31-2008, 04:13 PM Re: Contact form not sending
upstarter's Avatar
Average Talker

Posts: 26
Name: Starr Horne
Trades: 0
The first thing I'd do would be to make sure that the person's box has a mail server running and that PHP is configured to use it.
__________________
my company:
Please login or register to view this content. Registration is FREE


my blog:
Please login or register to view this content. Registration is FREE
upstarter is offline
Reply With Quote
View Public Profile Visit upstarter's homepage!
 
Old 05-31-2008, 06:02 PM Re: Contact form not sending
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
When I test my e-mail on their server it doesn't work.
When I test my e-mail on my server it does work.

So it can't be ^that

Tried ^^that, no luck
__________________

Please login or register to view this content. Registration is FREE
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 05-31-2008, 06:28 PM Re: Contact form not sending
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
Can you upload a phpinfo() script to their site and see if it is enabled to even send mail?
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 05-31-2008, 06:33 PM Re: Contact form not sending
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
See for yourself

http://www.sgilligan.co.uk/gaminginfo/info.html

^ I copied and pasted the source from phpinfo() on their server
__________________

Please login or register to view this content. Registration is FREE

Last edited by Gilligan; 05-31-2008 at 06:38 PM..
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 05-31-2008, 06:35 PM Re: Contact form not sending
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
Just a word of warning, I wouldn't post that online for security purposes...
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 05-31-2008, 06:38 PM Re: Contact form not sending
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
edited, and cropped the page for just the sendmail part
__________________

Please login or register to view this content. Registration is FREE
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 05-31-2008, 08:00 PM Re: Contact form not sending
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
sendmail doesn't seem to be installed. Do you know what they are running (Ubuntu, Slackware, CentOS, Windows)? If it's an apt enabled OS ask them to 'sudo apt-get install sendmail' I think you 'YUM sendmail' for YUM enabled OS's. After that ask them to 'sudo /etc/init.d/apache2 restart' to restart the apache2 server (apache is just apache, not sure about other servers) and see if you can get it to work. Also see if turning on errors gives you any information: error_reporting(E_ALL);
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Reply     « Reply to Contact form not sending
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 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.93266 seconds with 12 queries