Contact form trouble

This is a discussion on "Contact form trouble" within the PHP Forum section. This forum, and the thread "Contact form trouble are both part of the Program Your Website category.



 Subscribe in a reader

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

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Feb 3rd, 2007, 19:22
Junior Member
Join Date: Dec 2006
Location: Texas
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Contact form trouble

Ok, so I recently tried to create a contact form - located at: www.virtualofficeaid.com/contactus.html

The problem is, that everything seems to work fine, except the message never really gets sent. Any help in finding the problem would be appreciated.

HTML:
Code: Select all
<form method="post" action="mailer.php">
*Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
*Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br />
*Telephone Number:<br />
<input type="text" name="visitortelephone" size="35" />
<br /> <br />
<br />
Services You Are Interested In:<br />
                    <input type="checkbox" name="check[]" value="webdesign">
                    Wed Design<br />
                    <input type="checkbox" name="check[]" value="webmarketing">
                    Web Marketing / Management<br /> 
                    <input type="checkbox" name="check[]" value="concierge">
                    Concierge Services<br />
                    <input type="checkbox" name="check[]" value="desktop">
                    Desktop Publishing<br />
                    <input type="checkbox" name="check[]" value="event">
                    Event / Travel Planning<br />
                    <input type="checkbox" name="check[]" value="file">
                    File Conversion<br />
                    <input type="checkbox" name="check[]" value="transcription">
                    Transcription / Data Entry<br />
                    <input type="checkbox" name="check[]" value="market">
                    Market / Internet Research<br />
                    <input type="checkbox" name="check[]" value="present">
                    Presentations<br />
					<input type="checkbox" name="check[]" value="general">
					General Administrative
<br /><br />
How You Found The Site:<br />
<input type="text" name="visitorfeedback" size="35" />
<br /> <br />
<br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" name="submit" />
<br />
</form>
PHP
Code: Select all
<?php
if(isset($_POST['submit'])) {
  $to = "contact@virtualofficeaid.com"; 
  $subject = "Contact Form Results";
  $name = $_POST['visitor'] ;
  $email = $_POST['visitormail'] ;
  $telephone = $_POST['visitortelephone'] ;
  $message = $_POST['notes'] ;

foreach($_POST['check'] as $value) { 
$check_msg .= "Checked: $value\n";
} 
  
$body = "From: $visitor\n E-Mail: $visitoremail\n Telephone: $visitortelephone\n Found: $visitorfeedback\n Message:\n $message\n $check_msg";
  
  echo "Data has been submitted to $to!"; 
  mail($to, $subject, $body);
  
} else { 
echo "";
} 
?>
Also, i'd like to know if anyone knows a bit of code that will help me make some of the fields required. As in if they don't input a value for the field it will display an error message. Thank you.

Last edited by Ghost; Feb 3rd, 2007 at 19:25.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 4th, 2007, 01:11
New Member
Join Date: Dec 2006
Location: chennai India
Age: 38
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php mail Contact form trouble

http://www.php.net/function.mail

Have you checked with your hosting provider whether any special flags needs to be passed for making the php mail function work?

Some providers require a valid from email address of the same domain etc
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 4th, 2007, 05:15
Junior Member
Join Date: Dec 2006
Location: Texas
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form trouble

I use godaddy, if that helps.

I don't believe they have any special protocol for PHP, seeing as how it gets passed to the confirmation PHP page fine, just that no message ever shows up in my inbox.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 4th, 2007, 05:30
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form trouble

Check to make sure it's not going in your junk mail folder.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Feb 5th, 2007, 02:26
Junior Member
Join Date: Dec 2006
Location: Texas
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form trouble

Its not, already checked...

Does the code look sound though?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Feb 5th, 2007, 20:46
Reputable Member
Join Date: Oct 2006
Location: UK
Age: 25
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form trouble

Hi,

The code looks fine to me but it is pretty standard spam checking for your host to require that you put a valid from field at the end of your mail() function. so it could read:

Note: if your server requires it to be from your server then use $to if it just requires a vaild email address use $visitormail

Code: Select all
mail($to, $subject, $body, "From:".$to);
Hope this helps??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Feb 7th, 2007, 17:39
Junior Member
Join Date: Dec 2006
Location: Texas
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form trouble

Quote:
Originally Posted by cullinanweb View Post
Hi,

The code looks fine to me but it is pretty standard spam checking for your host to require that you put a valid from field at the end of your mail() function. so it could read:

Note: if your server requires it to be from your server then use $to if it just requires a vaild email address use $visitormail

Code: Select all
mail($to, $subject, $body, "From:".$to);
Hope this helps??
I tried adjusting the code and for some reason it still dosn't want to work.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Feb 19th, 2007, 13:25
Reputable Member
Join Date: Oct 2006
Location: UK
Age: 25
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form trouble

just had a quick look at your host and it seems that you have to use their standard PHP-Mailer tool. Look in the support section of their site for more help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Feb 27th, 2007, 00:05
Junior Member
Join Date: Dec 2006
Location: Texas
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form trouble

Quote:
Originally Posted by cullinanweb View Post
just had a quick look at your host and it seems that you have to use their standard PHP-Mailer tool. Look in the support section of their site for more help.
Hmm, I looked at the support section and it said that godaddy does support PHP. They have a contact form creater but its part of their web site builder service that I don't exactly need.

I couldn't imagine that would be the only way to get a contact form working though...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Mar 10th, 2007, 00:15
Junior Member
Join Date: Jan 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form trouble

The mail command returns 1 on success and 0 on failure - simple thing to do is to say:
$doesthiswork = mail($to, $subject, $body);
print "the result was --> $doesthiswork";

That will show you if the mail command is working or not.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Mar 10th, 2007, 00:20
Elite Veteran
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact form trouble

It should work. I have used godaddy in the past, and unless they have changed their standards you can of course build your own PHP send mail script. I know I have in the past, or of course you can use the one they supply you with.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
contact

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
help with asp contact form? Ella Classic ASP 4 Jan 2nd, 2008 00:45
Contact Us Form - Help Please tygwyn JavaScript Forum 4 Sep 10th, 2007 10:36
php contact form geyids PHP Forum 5 Jun 14th, 2007 16:59
Need Quote Form and Contact Form Av8er Flash & Multimedia Forum 5 Oct 30th, 2003 17:14


All times are GMT. The time now is 06:07.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization 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