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 help! Complete Beginer.
Old 07-25-2010, 10:05 AM Contact form help! Complete Beginer.
Junior Talker

Posts: 1
Name: Viki
Trades: 0
Hi I'm mainly a website designer and I thought I would put a contact form on my new portfolio website.

With the help of a friend who had already added a contact form to her site.

we cant see an issue with the code but it is refusing to send emails to my website. And the echo messages wont appear on the website.

I was wondering if any one could help!

PHP Code:
<?php
//COLLECT POST data
$formValue=array();
foreach (
$_POST as $key => $value) {
$formValue[$key] = strip_tags($value);
}


if(isset(
$_GET['sendmail'])){

//Check for empty fields 

if($formValue['name']==""){
            
$message="Sorry! I need to know your name. Please complete all fields.";
            
header("Location: contact.php?message=$message") ;
            
}else if(
$formValue['email']==""){
            
$message="Sorry! I need your email address. Please complete all fields.";
            
header("Location: contact.php?message=$message");
            
}else if(
$formValue['comment']==""){
                    
$message="I think you forgot to leave me a message!?";
                    
header("Location: contact.php?message=$message");
                                            
                                
                
                }else{    


$name =  $_POST['name'] ;
$email =  $_POST['email'] ;
$comment =  $_POST['comment'] ;

$subject "Website Comment";

$from "$name \n
$email";

$body "$comment";

ini_set("sendmail_from""victoriahogg@hotmail.com");
mail('victoriahogg@hotmail.com'$subject$body$from);

$message "Thank you for your message" ;
header("Location: thankyou.php?message=$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 rel="stylesheet" type="text/css" href="style_contact.css">
<title>Victoriahogg.com</title>

</head>
<body onload="MM_preloadImages('images/rollover_home.gif','images/rollover_about me.gif','images/rollover_work.gif','images/rollover_contact.gif')">

<div id="wrapper">

<div id="nav">
<a href="index.html"><img src="images/home.gif" alt="Home" name="Home" width="192" height="48" border="0" id="Home" /></a>
<a href="about.html"><img src="images/about me.gif" alt="About Me" name="About Me" width="193" height="48" border="0" id="About Me" /></a>
<a href="work.html"><img src="images/work.gif" alt="Work" name="Work" width="194" height="48" border="0" id="Work" /></a>
<a href="contact.html"><img src="images/contact.gif" alt="Contact Me" name="Contact" width="195" height="48" border="0" id="Contact" /></a></div>

<div id="banner"> </div>

<div id="folder">

<div id="content"> 

<h1><center>Contact me.</center></h1>
    <blockquote>
<form id="contactForm" action="contact.php?sendmail=1" method="post" name="contactForm">
                            
            <input type="hidden" name="about" value="Website Comment">
            <label>Name: </label> <input class="inputField" type="text" name="name" size="35"><br /><br />

            <label>Email:</label> <input class="inputField" type="text" name="email" size="35"><br /><br />
                        
                            
            <label>Comments:</label><br />
            <textarea class="textArea" name="comment" rows="9" cols="35"></textarea>
                            <br />
                            <br />

            <input class="sendButton" name="submit" type="submit" value="Submit" title="Submit"/>
                            
            </form>
               <p><?php echo $message ;?></p>      
</blockquote>
</div>
<div id="footer"> (c) Victoria Hogg 2010</div>
</div>
</div>

</body>
</html>
And this is the thank you form.

PHP Code:
<?php
//COLLECT POST data
$formValue=array();
foreach (
$_POST as $key => $value) {
$formValue[$key] = strip_tags($value);
}


if(isset(
$_GET['sendmail'])){

//Check for empty fields 

if($formValue['name']==""){
            
$message="Sorry! I need to know your name. Please complete all fields.";
            
header("Location: contact.php?message=$message") ;
            
}else if(
$formValue['email']==""){
            
$message="Sorry! I need your email address. Please complete all fields.";
            
header("Location: contact.php?message=$message");
            
}else if(
$formValue['comment']==""){
                    
$message="I think you forgot to leave me a message!?";
                    
header("Location: contact.php?message=$message");
                                            
                                
                
                }else{    


$name =  $_POST['name'] ;
$email =  $_POST['email'] ;
$comment =  $_POST['comment'] ;

$subject "Website Comment";

$from "$name \n
$email";

$body "$comment";

ini_set("sendmail_from""victoriahogg@hotmail.com");
mail('victoriahogg@hotmail.com'$subject$body$from);

$message "Thank you for your message" ;
header("Location: thankyou.php?message=$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 rel="stylesheet" type="text/css" href="style_contact.css">
<title>Victoriahogg.com</title>

</head>
<body onload="MM_preloadImages('images/rollover_home.gif','images/rollover_about me.gif','images/rollover_work.gif','images/rollover_contact.gif')">

<div id="wrapper">

<div id="nav">
<a href="index.html"><img src="images/home.gif" alt="Home" name="Home" width="192" height="48" border="0" id="Home" /></a>
<a href="about.html"><img src="images/about me.gif" alt="About Me" name="About Me" width="193" height="48" border="0" id="About Me" /></a>
<a href="work.html"><img src="images/work.gif" alt="Work" name="Work" width="194" height="48" border="0" id="Work" /></a>
<a href="contact.html"><img src="images/contact.gif" alt="Contact Me" name="Contact" width="195" height="48" border="0" id="Contact" /></a></div>

<div id="banner"> </div>

<div id="folder">

<div id="content"> 

<h1><center>Contact me.</center></h1>
    <blockquote>
      <p>Thank you for your Message. I will try and get back to you as soon as possible. <?php echo $message ;?></p>
    </blockquote>
</div>
<div id="footer"> (c) Victoria Hogg 2010</div>
</div>
</div>

</body>
</html>
Thank you in advance.
senry is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-25-2010, 04:06 PM Re: Contact form help! Complete Beginer.
Defies a Status

Posts: 1,606
Trades: 0
Try using a real email account and not a hotmail account.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 07-25-2010, 04:16 PM Re: Contact form help! Complete Beginer.
britoniah3480's Avatar
Average Talker

Posts: 17
Name: Darz
Trades: 0
is SMTP enabled? it might be the problem...
britoniah3480 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Contact form help! Complete Beginer.
 

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