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 04-11-2005, 05:01 AM adding more fields
Novice Talker

Posts: 7
Trades: 0
hi, i would like to add these two topics in my php form, but im struggling as where to put it.

the two are: phone and address

heres my entire code if it helps
------------------------------------------
<?php
/************************************************** *\
* PHP 4.1.0+ version of email script. For more
* information on the mail() function for PHP, see
* http://www.php.net/manual/en/function.mail.php
\************************************************* **/


// First, set up some variables to serve you in
// getting an email. This includes the email this is
// sent to (yours) and what the subject of this email
// should be. It's a good idea to choose your own
// subject instead of allowing the user to. This will
// help prevent spam filters from snatching this email
// out from under your nose when something unusual is put.

$sendTo = "dazzclub@yahoo.co.uk";
$subject = "BH thermochromic inks";

// variables are sent to this PHP page through
// the POST method. $_POST is a global associative array
// of variables passed through this method. From that, we
// can get the values sent to this page from Flash and
// assign them to appropriate variables which can be used
// in the PHP mail() function.


// header information not including sendTo and Subject
// these all go in one variable. First, include From:
$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"].">\r\n";

// next include a replyto
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
// often email servers won't allow emails to be sent to
// domains other than their own. The return path here will
// often lift that restriction so, for instance, you could send
// email to a hotmail account. (hosting provider settings may vary)
// technically bounced email is supposed to go to the return-path email
$headers .= "Return-path: " . $_POST["email"];

// now we can add the content of the message to a body variable
$message = $_POST["message"];



// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers, $body );

?>
--------------------
thanks
dazzclub is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-11-2005, 07:19 AM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
PHP Code:
// now we can add the content of the message to a body variable
$frm_message $_POST['message'];
$frm_phone $_POST['phone'];
$frm_address $_POST['address'];

$message .= "Below is what was submitted via your online form\n\n";
$message .= "Message: ";
$message .= $frm_message;
$message .= "\n\n Phone: "
$message .= $frm_phone;
$message .= "\n\n Address: "
$message .= $frm_address
That should do it. Just to explain what i've done, i've placed all the form information into seperate variabels, prefixed with frm_ so you can distinguish them easily.

Then, i placed all this into the $message variable (this is what will actually appear in your email). Notice the .=? Well this allows you to add to a variable that may already have information stored in it, without deleting anything within it. The \n\n that you see allows for new lines (n stands for new line )

Hope this helps, sorry if i seem a little rushed!
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-11-2005, 08:40 AM
Novice Talker

Posts: 7
Trades: 0
hi thaks for the quick relply, ive pasted that code in my php form, but still the phone number and address arent sent, i think im puttin it in wrong heres what it looks like.

-----------------------------
<?php

$sendTo = "dazzclub@yahoo.co.uk";
$subject = "BH thermochromic inks";

// variables are sent to this PHP page through
// the POST method. $_POST is a global associative array
// of variables passed through this method. From that, we
// can get the values sent to this page from Flash and
// assign them to appropriate variables which can be used
// in the PHP mail() function.


// header information not including sendTo and Subject
// these all go in one variable. First, include From:
$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"].">\r\n";

// next include a replyto
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
// often email servers won't allow emails to be sent to
// domains other than their own. The return path here will
// often lift that restriction so, for instance, you could send
// email to a hotmail account. (hosting provider settings may vary)
// technically bounced email is supposed to go to the return-path email
$headers .= "Return-path: " . $_POST["email"];

// now we can add the content of the message to a body variable
$message = $_POST["message"];
$frm_message = $_POST['message'];
$frm_phone = $_POST['phone'];
$frm_address = $_POST['address'];

$message .= "Below is what was submitted via your online form\n\n";
$message .= "Message: ";
$message .= $frm_message;
$message .= "\n\n Phone: "
$message .= $frm_phone;
$message .= "\n\n Address: "
$message .= $frm_address;


// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers, $body );

?>

sorry for pasting the whole thing, it gets the problem across easier than me explaining.

thanks again,
dazzclub is offline
Reply With Quote
View Public Profile
 
Old 04-11-2005, 09:08 AM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
ok, does everything else come through except the phone and address values?

so you still get:
"Below is what was submitted via your online form

Message: bla bla bla

Phone:

Address:"

It should make any different, but replace
PHP Code:
$frm_message $_POST['message']; 
$frm_phone $_POST['phone']; 
$frm_address $_POST['address']; 
with
PHP Code:
$frm_message $_POST["message"]; 
$frm_phone $_POST["phone"]; 
$frm_address $_POST["address"]; 
Also, on your actual form that users fill out to send the email, have you got the values set correctly, as in
HTML Code:
<INPUT TYPE="TEXT" NAME="phone" VALUE="">
<INPUT TYPE="TEXT" NAME="address" VALUE="">
??
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-11-2005, 10:24 AM
Novice Talker

Posts: 7
Trades: 0
I`ve tried what u suggested but no luck, i didnt even get "message blah blah" the first time i added ur code to my php. only thing coming through was what ever i written in the message part, the email they put in , the subject title of the email and my email.

am I stuffed? Royal style?
thanks for helping
dazzclub is offline
Reply With Quote
View Public Profile
 
Old 04-11-2005, 12:26 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
That's pretty weird...

Try echoing all the value, so instead of sending the mail off at the end, do this:

PHP Code:
echo('
Raw Message: ' 
$frm_message '<BR>
Phone Number: ' 
$frm_phone '<BR>
Address: ' 
$frm_address '<BR>
Emailed Message: ' 
$message '); 
Put that instead of the mail() and see what it outputs, it should have a value for each. If it does not we know where the problem is - im pretty certain what I gave you is correct.

See what happens
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-12-2005, 06:10 AM
Novice Talker

Posts: 7
Trades: 0
Hi

My php file is to go with a flash form, not a html file. this could be the problem.

thanks for ur help, cheers
dazzclub is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to adding more fields
 

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