Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1604 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

Php Help

Thread title: Php Help
Closed Thread    
    Thread tools Search this thread Display Modes  
12-18-2005, 09:20 PM
#1
asnutting is offline asnutting
asnutting's Avatar
Status: Member
Join date: Aug 2005
Location: Kansas
Expertise:
Software:
 
Posts: 108
iTrader: 0 / 0%
 

asnutting is on a distinguished road

Send a message via AIM to asnutting Send a message via MSN to asnutting Send a message via Yahoo to asnutting

  Old  Php Help

Hello I dont know a whole lot of php and thought I woul ask you all. I am creating a simple php contact form. What I want to do is take the email from the contact form and use it as the value for the email so when it is sent it will show up in the persons email box from the sender of the contact form's email. Can Anyone Help. I have Included the code that I have. I have been able to get it to work on a different host with a very similar code. Howerver the host requires that the email be sent from somone other than the email account the email is being sent.

Thanks
Adam


<html>
<head>
<?
$from = $_POST['email']
$to = "<testemail@mail.com";
$subject = "Contact Form Submission";
$body = "Name: ";
$body .= $_REQUEST['Name'] . "\r\n\n";
$body .= "Email: ";
$body .= $_REQUEST['email'] . "\r\n\n";
$body .= "Phone: ";
$body .= $_REQUEST['phone'] . "\r\n\n";
$body .= "Address: ";
$body .= $_REQUEST['address'] . "\r\n\n";
$body .= "Address2: ";
$body .= $_REQUEST['address2'] . "\r\n\n";
$body .= "City: ";
$body .= $_REQUEST['city'] . "\r\n\n";
$body .= "State: ";
$body .= $_REQUEST['state'] . "\r\n\n";
$body .= "Zipcode: ";
$body .= $_REQUEST['zip'] . "\r\n\n";
$body .= "Party Affiliation: ";
$body .= $_REQUEST['party'] . "\r\n\n";
$body .="Message: ";
$body .= $_REQUEST['message'] . "\r\n\n";


mail($from,$to,$subject,$body)

?>
<script language="JavaScript" type="text/JavaScript">
<!--
window.location.href = "success.htm";
//-->
</script>
</head>
<body>
</body>
</html>

12-19-2005, 02:42 AM
#2
Joe is offline Joe
Status: Custom User Title
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 2,297
iTrader: 0 / 0%
 

Joe is on a distinguished road

  Old

Sorry, but I don't quite understand what you exactly want to do. The PHP script above would include the inputted email as the sender. Does that code not work on your host or something?

12-19-2005, 06:01 AM
#3
Dray is offline Dray
Dray's Avatar
Status: Request a custom title
Join date: Sep 2005
Location: Texas
Expertise:
Software:
 
Posts: 1,139
iTrader: 0 / 0%
 

Dray is on a distinguished road

  Old

First of all that code is very buggy. You're missing several semi-colons ";" Fix those...second of all...what exactly do you want it to do? Someone inputs his own email and the recipient's email and then this mailer form sends an e-mail to the recipient from him?

12-19-2005, 08:19 AM
#4
asnutting is offline asnutting
asnutting's Avatar
Status: Member
Join date: Aug 2005
Location: Kansas
Expertise:
Software:
 
Posts: 108
iTrader: 0 / 0%
 

asnutting is on a distinguished road

Send a message via AIM to asnutting Send a message via MSN to asnutting Send a message via Yahoo to asnutting

  Old


Hello I dont know a whole lot of php and thought I woul ask you all.
Hey man dont chew my head off I want the person to input their email address into the email text box and when my client recieves the email it will show them that it is being sent by whatever address the person puts into the box when they submit it.FEEL FREE TO FIX AND GIVE SUGGESTIONS My client is using godaddy.com for the host and the godaddy.com site is not very helpfull when it comes to specifics and such about how they want the php coded. I have seen some places that are very specific on the how to and from parts are coded.

Thanks
Adam

12-19-2005, 09:39 AM
#5
NeiL is offline NeiL
NeiL's Avatar
Status: Member
Join date: Oct 2005
Location: Derby, England
Expertise: Graphic/Web Design
Software: Photoshop CS3
 
Posts: 325
iTrader: 4 / 100%
 

NeiL is on a distinguished road

  Old

if you go to http://www.pixel2life.com/tutorials/...5&d=1&ss=email they have a lot of tutorials on this subject.

12-23-2005, 03:41 PM
#6
Xemion is offline Xemion
Status: I'm new around here
Join date: Jun 2005
Location:
Expertise:
Software:
 
Posts: 16
iTrader: 0 / 0%
 

Xemion is on a distinguished road

  Old

Try this...
PHP Code:
<?php
$from 
$_POST['email'];
$to "testemail@mail.com";
$subject "Contact Form Submission";
$body "Name: ";
$body .= $_REQUEST['Name'] . "\r\n\n";
$body .= "Email: ";
$body .= $_REQUEST['email'] . "\r\n\n";
$body .= "Phone: ";
$body .= $_REQUEST['phone'] . "\r\n\n";
$body .= "Address: ";
$body .= $_REQUEST['address'] . "\r\n\n";
$body .= "Address2: ";
$body .= $_REQUEST['address2'] . "\r\n\n";
$body .= "City: ";
$body .= $_REQUEST['city'] . "\r\n\n";
$body .= "State: ";
$body .= $_REQUEST['state'] . "\r\n\n";
$body .= "Zipcode: ";
$body .= $_REQUEST['zip'] . "\r\n\n";
$body .= "Party Affiliation: ";
$body .= $_REQUEST['party'] . "\r\n\n";
$body .="Message: ";
$body .= $_REQUEST['message'] . "\r\n\n";
mail($from,$to,$subject,$body)
header("Location: thankyou.html");
?>
That should work. Make sure, as the first poster suggested, that you always end your lines with semi-colons. Other than that, I removed < from the e-mail line and just used a PHP redirect instead of a javascript.

Closed Thread    


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

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed