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
Old 11-18-2007, 05:39 PM Contact Us
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
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
 
 
Register now for full access!
Old 11-18-2007, 07:30 PM Re: Contact Us
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
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, 08:13 PM Re: Contact Us
Novice Talker

Posts: 13
Trades: 0
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>
__________________

Please login or register to view this content. Registration is FREE
- Find your Stuff!

Please login or register to view this content. Registration is FREE
- Merchant Accounts for Business

Please login or register to view this content. Registration is FREE
- ECommerce Solutions
ericsante is offline
Reply With Quote
View Public Profile
 
Old 11-20-2007, 12:21 PM Re: Contact Us
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
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, 12:41 PM Re: Contact Us
Foundationflash's Avatar
Ultra Talker

Posts: 410
Name: Harry Burt
Location: Colchester, Essex, England
Trades: 0
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 :
Please login or register to view this content. Registration is FREE


New Dreamed Up Web Design:
Please login or register to view this content. Registration is FREE
Foundationflash is offline
Reply With Quote
View Public Profile Visit Foundationflash's homepage!
 
Old 11-20-2007, 01:14 PM Re: Contact Us
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
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, 12:25 PM Re: Contact Us
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
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, 02:07 PM Re: Contact Us
Super Talker

Posts: 134
Trades: 0
<?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");
?>
__________________

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

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 11-21-2007, 02:24 PM Re: Contact Us
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
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, 03:22 PM Re: Contact Us
Foundationflash's Avatar
Ultra Talker

Posts: 410
Name: Harry Burt
Location: Colchester, Essex, England
Trades: 0
Any error messages? You might need to check your error logs. Are you running this on a local or remote server?
__________________
Foundation Flash tutorials :
Please login or register to view this content. Registration is FREE


New Dreamed Up Web Design:
Please login or register to view this content. Registration is FREE
Foundationflash is offline
Reply With Quote
View Public Profile Visit Foundationflash's homepage!
 
Old 11-21-2007, 03:44 PM Re: Contact Us
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
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, 09:58 PM Re: Contact Us
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
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, 06:27 AM Re: Contact Us
Junior Talker

Posts: 3
Name: Veselin Stoilov
Trades: 0
take a look here Contact form in PHP
__________________

Please login or register to view this content. Registration is FREE
- Webmasters tools and help
Veselin Stoilov is offline
Reply With Quote
View Public Profile Visit Veselin Stoilov's homepage!
 
Old 11-23-2007, 07:59 PM Re: Contact Us
Harlequin's Avatar
Extreme Talker

Posts: 166
Name: Mick
Location: Tenerife
Trades: 0
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, 04:32 AM Re: Contact Us
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
sounds like dont have PHP support...
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 11-24-2007, 09:17 AM Re: Contact Us
Super Talker

Posts: 134
Trades: 0
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
__________________

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

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 11-24-2007, 12:17 PM Re: Contact Us
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
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, 05:09 AM Re: Contact Us
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
If it doesnt (i not sure) give me a email or PM and i could sort you would with some hosting
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 11-25-2007, 06:21 AM Re: Contact Us
Ultra Talker

Posts: 310
Trades: 0
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.
dman_2007 is offline
Reply With Quote
View Public Profile
 
Old 11-25-2007, 10:20 AM Re: Contact Us
Super Talker

Posts: 134
Trades: 0
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
__________________

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

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Contact Us

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