Webmaster Forum



Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-09-2010, 11:25 AM
Member
 
Join Date: 03-07-05
Posts: 42
iTrader: 0 / 0%
thedude is liked by many
Contact form PHP

I recently downloaded a template from dreamtemplates and need help with the contact form. I am using Dreamweaver and the contact page came with a pre done form on contact.html page and a php file. Please if anyone can help on how to get it to work. I know I have to turn on php in control panel with hosting company (godaddy) but now sure what to change to get sumbission to my email address. (the form fields are fine just need to submit to my email address)

Here is copy of php code and screen print of contact.html page
PHP Code:
<?php

if(!$_POST) exit;

$email $_POST['email'];


//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
    
$error.="Invalid email address entered";
    
$errors=1;
}
if(
$errors==1) echo $error;
else{
    
$values = array ('name','email','message');
    
$required = array('name','email','message');
     
    
$your_email "james@example.com";
    
$email_subject "New Message: ".$_POST['subject'];
    
$email_content "new message:\n";
    
    foreach(
$values as $key => $value){
      if(
in_array($value,$required)){
        if (
$key != 'subject' && $key != 'company') {
          if( empty(
$_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
        }
        
$email_content .= $value.': '.$_POST[$value]."\n";
      }
    }
     
    if(@
mail($your_email,$email_subject,$email_content)) {
        echo 
'Message sent!'
    } else {
        echo 
'ERROR!';
    }
}
?>
Please help.....
Attached Files
File Type: pdf contact.pdf (38.2 KB, 79 views)

Last edited by HTMLBasicTutor; 04-09-2010 at 12:08 PM.
Share |
Reply With Quote
  #2 (permalink)  
Old 04-09-2010, 12:10 PM
HTMLBasicTutor's Avatar
Super Moderator
 
Join Date: 10-29-07
Location: British Columbia, Canada
Posts: 15,619
iTrader: 5 / 100%
HTMLBasicTutor is supreme webmaster materialHTMLBasicTutor is supreme webmaster materialHTMLBasicTutor is supreme webmaster materialHTMLBasicTutor is supreme webmaster materialHTMLBasicTutor is supreme webmaster materialHTMLBasicTutor is supreme webmaster materialHTMLBasicTutor is supreme webmaster materialHTMLBasicTutor is supreme webmaster materialHTMLBasicTutor is supreme webmaster materialHTMLBasicTutor is supreme webmaster materialHTMLBasicTutor is supreme webmaster material
Change this line:
PHP Code:
$your_email "james@example.com"
To use an email you own then test again.
__________________

HTML Basic Tutor - Learn how to code for better SEO
Basic Computer Information - Computer & internet basics for website owners

SEO troubleshooting service available. - Pm me.
Share |
Reply With Quote
  #3 (permalink)  
Old 04-09-2010, 01:39 PM
Member
 
Join Date: 03-07-05
Posts: 42
iTrader: 0 / 0%
thedude is liked by many
thanks

Thanks,
One more question I have is email came from
anonymous@ip-208-109-105-145.ip.secureserver.net
when I tested form. How do I get it to come from something that will not be spam or label as contact form mywebsite

Last edited by HTMLBasicTutor; 04-09-2010 at 01:55 PM.
Share |
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
contact form silver163 Coding Forum 4 10-08-2009 12:00 PM
I need help with contact form iorgyzu88 Coding Forum 7 09-17-2009 10:37 AM
What's the best way to set up a Contact form??? chrisnrach17 Web Design Lobby 8 12-06-2008 01:10 AM
Contact form please help to create a contact form jennypretty Coding Forum 2 07-03-2008 07:49 AM
Need help with contact form gordon Coding Forum 9 05-13-2008 04:44 PM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 02:09 AM.
Powered by vBulletin
Copyright © 2000-2011 Jelsoft Enterprises Limited.
Copyright © 2003 - 2011 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.