Reply
Contact Us
Old 11-18-2007, 06:39 PM Contact Us
Experienced Talker

Posts: 33
Name: Brian
Can someone help me out with making a Contact Us page. Or atleast point me in the right direction.

Thanks
bdg1115 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-18-2007, 08:30 PM Re: Contact Us
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
What do you want it to say and what is your current CSS looking like?
__________________
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 11-18-2007, 09:13 PM Re: Contact Us
Novice Talker

Posts: 13
this is untested code however it should work.

if you want more fields you can add them to the form, to send them to the toemail, make sure you add a variable name and a $_get for each form.


Code:
<!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" />
<title>contact.php</title>
</head>

 
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST") {
// process form

    $name = $_GET['Name'];
    $toemail = "email@yourdomain.com";
    $fromemail = $_GET[['Email'];
    $phone = $_GET['Phone'];
    $message = $_GET['Message'];
    $headers  = 'From: WebSite <noreply@noreply.com>' . "\r\n";
    $headers .= 'Reply-To: noreply@yourdomain.com' . "\r\n";
    $headers .= 'X-Mailer: PHP/' . phpversion();
    $headers .= 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
//set the subject line for the email message
    $subject = "WebSite Contact Page";
//here we build the body of the message to be sent.    
    $message = "Hello, I just sent you this web inquery. \r\n My name is: $name \r\n My email address is: $toemail\r\n My phone number is: $phone\r\n My Message is: $mess\r\n";
    mail($toemail, $subject, $message, $headers); // , $from Send the email!

?>

<body>
<form id="form1" name="form1" method="post" action="contact.php?post">
<p>Name: 
  <label>
  <input type="text" name="Name" id="Name" />
  </label>
</p>
<p>Phone:
  <label>
  <input type="text" name="Phone" id="Phone" />
  </label>
</p>
  <p>Email: 
    <label>
    <input type="text" name="email" id="email" />
    </label>
</p>
  <p>Message:<br />
    <label>
      <textarea name="mess" id="mess" cols="45" rows="5"></textarea>
    </label>
  </p>
  <label><br />
  </label>
    <label>
      <input type="submit" name="submit" id="submit" value="Submit" />
  </label>
</form>
</body>
</html>
__________________
http://www.JawYak.com - Find your Stuff!
http://www.FDIS-Miami.com - Merchant Accounts for Business
http://www.TrillianMerchants.com - ECommerce Solutions
ericsante is offline
Reply With Quote
View Public Profile
 
Old 11-20-2007, 01:21 PM Re: Contact Us
Experienced Talker

Posts: 33
Name: Brian
Thanks. I appreciate the help.

I have another question. Why when I try to test it, i hit send. But it trys to download the php file?

Thanks in advance
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 11-20-2007, 01:41 PM Re: Contact Us
Foundationflash's Avatar
Ultra Talker

Posts: 410
Name: Harry Burt
Location: Colchester, Essex, England
I would do it like so:
PHP Code:
<!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" />
<title>contact.php</title>
</head>

 
<?php
if ($_POST) {
// process form

    
$name $_POST['Name'];
    
$toemail "email@yourdomain.com";
    
$fromemail $_POST[['Email'];
    
$phone $_POST['Phone'];
    
$message $_POST['Message'];
    
$headers  'From: WebSite <noreply@noreply.com>' "\r\n";
    
$headers .= 'Reply-To: noreply@yourdomain.com' "\r\n";
    
$headers .= 'X-Mailer: PHP/' phpversion();
    
$headers .= 'MIME-Version: 1.0' "\r\n";
    
$headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n"
//set the subject line for the email message
    
$subject "WebSite Contact Page";
//here we build the body of the message to be sent.    
    
$message "Hello, I just sent you this web enquiry. \r\n My name is: $name \r\n My email address is: $toemail\r\n My phone number is: $phone\r\n My Message is: $mess\r\n";
    
mail($toemail$subject$message$headers); // , $from Send the email!

?>

<body>
<form id="form1" name="form1" method="post" action="contact.php">
<p>Name: 
  <label>
  <input type="text" name="Name" id="Name" />
  </label>
</p>
<p>Phone:
  <label>
  <input type="text" name="Phone" id="Phone" />
  </label>
</p>
  <p>Email: 
    <label>
    <input type="text" name="email" id="email" />
    </label>
</p>
  <p>Message:<br />
    <label>
      <textarea name="mess" id="mess" cols="45" rows="5"></textarea>
    </label>
  </p>
  <label><br />
  </label>
    <label>
      <input type="submit" name="submit" id="submit" value="Submit" />
  </label>
</form>
</body>
</html>
__________________
Foundation Flash tutorials : www.foundation-flash.com

New Dreamed Up Web Design: www.dreamedupdesign.com
Foundationflash is offline
Reply With Quote
View Public Profile Visit Foundationflash's homepage!
 
Old 11-20-2007, 02:14 PM Re: Contact Us
Experienced Talker

Posts: 33
Name: Brian
Thanks for the help.

Would I just paste all of that into dreamweaver? Or do i need to put the PHP part in a php file and then the forms and stuff in an html file?

When I try to test it out it opens this download box. Asking weather I would like to run or save it. Am i doing something wrong?

Thanks in advance
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 11-21-2007, 01:25 PM Re: Contact Us
Experienced Talker

Posts: 33
Name: Brian
Can you take a look at the code, and what i am doing to make sure I am doing this right.

I put this into the html box with html tags and all:

<form method="post" action="form.php">
Name:<input name="name" type="text" id="name"><br>
Email:<input name="email" type="text" id="email"><br>
Subject:<input name="subject" type="text" id="subject"><br>
Message:<textarea name="comments" id="textarea"></textarea><br>
<input type="submit" name="Submit" value="SUBMIT">
</form>

Then in another file i named it 'form.php' no html tags:

<?php
//Declare the variables
$recipient = "your e-mail here";
$message = "name: $name
email: $email
subject: $subject
message: $comments";
//Contents of form
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$comments=$_POST['comments'];
//mail() function sends the mail
mail($recipient,$subject,$message);
//This line sends to thankyou page when finished
header("Location: thankyou.htm");
?>

Is that right? For some reason its not working. When i put it up on the internet it sends me to that thank you page, but the messages or anything does not come into my e-mail.

Thanks in advance.
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 11-21-2007, 03:07 PM Re: Contact Us
Skilled Talker

Posts: 91
<?php
//Declare the variables
//Contents of form
$recipient = "xxxxx@gmail.com";
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$comments=$_POST['comments'];
$message = "name: $name
email: $email
subject: $subject
message: $comments";
//mail() function sends the mail
mail($recipient,$subject,$message);
//This line sends to thankyou page when finished
header("Location: thankyou.htm");
?>
Falcone is offline
Reply With Quote
View Public Profile
 
Old 11-21-2007, 03:24 PM Re: Contact Us
Experienced Talker

Posts: 33
Name: Brian
Thanks, but its still not working. I am not sure what I am doing wrong. I'm new to php.
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 11-21-2007, 04:22 PM Re: Contact Us
Foundationflash's Avatar
Ultra Talker

Posts: 410
Name: Harry Burt
Location: Colchester, Essex, England
Any error messages? You might need to check your error logs. Are you running this on a local or remote server?
__________________
Foundation Flash tutorials : www.foundation-flash.com

New Dreamed Up Web Design: www.dreamedupdesign.com
Foundationflash is offline
Reply With Quote
View Public Profile Visit Foundationflash's homepage!
 
Old 11-21-2007, 04:44 PM Re: Contact Us
Experienced Talker

Posts: 33
Name: Brian
I am running it on go daddy? im not really sure what i am doing. haha where can i find the error messages?
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 11-22-2007, 10:58 PM Re: Contact Us
Experienced Talker

Posts: 33
Name: Brian
Anyone just want to do it for me and send me the stuff? haha.. i cant figure it out.
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 11-23-2007, 07:27 AM Re: Contact Us
Junior Talker

Posts: 3
Name: Veselin Stoilov
take a look here Contact form in PHP
__________________
www.phpjabbers.com - Webmasters tools and help
Veselin Stoilov is offline
Reply With Quote
View Public Profile Visit Veselin Stoilov's homepage!
 
Old 11-23-2007, 08:59 PM Re: Contact Us
Harlequin's Avatar
Extreme Talker

Posts: 150
Name: Mick
Location: Tenerife
if you are still having trouble with this take a look at www.websitedesigntenerife.net, I have a basic contact form there that sends a mail to me when someone uses it as I'm sick of getting SPAM. If it's what you want, use the form and I'll send you the source code.
Harlequin is offline
Reply With Quote
View Public Profile Visit Harlequin's homepage!
 
Old 11-24-2007, 05:32 AM Re: Contact Us
dansgalaxy's Avatar
Eat, Sleep, Code

Posts: 6,284
Name: Dan
Location: Swindon
sounds like dont have PHP support...
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 11-24-2007, 10:17 AM Re: Contact Us
Skilled Talker

Posts: 91
Quote:
Originally Posted by bdg1115 View Post
Thanks for the help.

Would I just paste all of that into dreamweaver? Or do i need to put the PHP part in a php file and then the forms and stuff in an html file?

When I try to test it out it opens this download box. Asking weather I would like to run or save it. Am i doing something wrong?

Thanks in advance
php code should be in a file with php extention --> testfile.php

you have to test in on a server that supports php, local or online
Falcone is offline
Reply With Quote
View Public Profile
 
Old 11-24-2007, 01:17 PM Re: Contact Us
Experienced Talker

Posts: 33
Name: Brian
I use godaddy to host my website. Does that not support it? Thats strange
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 11-25-2007, 06:09 AM Re: Contact Us
dansgalaxy's Avatar
Eat, Sleep, Code

Posts: 6,284
Name: Dan
Location: Swindon
If it doesnt (i not sure) give me a email or PM and i could sort you would with some hosting
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 11-25-2007, 07:21 AM Re: Contact Us
Ultra Talker

Posts: 308
Quote:
Originally Posted by bdg1115 View Post
I use godaddy to host my website. Does that not support it? Thats strange
If you have a linux hosting plan then it does otherwise it doesn't.
__________________
tiny url
dman_2007 is offline
Reply With Quote
View Public Profile Visit dman_2007's homepage!
 
Old 11-25-2007, 11:20 AM Re: Contact Us
Skilled Talker

Posts: 91
the redirection is working, so there is php support, maybe php sendmail is not enabled or the mail is blocked somewhere by a spam filter
Falcone is offline