Need help fixing a mailto form...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
WithHisStripes
Forum Contributor
Posts: 131
Joined: Tue Sep 13, 2005 7:48 pm

Need help fixing a mailto form...

Post by WithHisStripes »

Heya,
I am working on a form that is emailed to me, but I have a problem with the code; for the telephone line, for example, there are four text fields, 'country code', 'area code', '3_digit' and '4_digit;. I want them, once emailed to me, to appear on the same line. An example is below:

First Name: Spencer
Last Name: Hill
Email: Whomever@Whatever.com
Telephone: 1(503)-885-9999
City: Sherwood
State or Province: OR
Name of State or Province If It Wasn't Listed: Oregon
Country: Australia
Skills and Abilities: Blah blah blah
Comments: Comments

But what happens, is the telephone and any other lines that I want to be listed on the same line (ie the telephone number) won't even appear.

Here is my code:

//General Information
$msg="First Name: " . $_POST['first_name'] . "\n";
$msg.="Last Name: " . $_POST['last_name']. "\n";
$msg.="Email: " . $_POST['email']. "\n";
$msg.="Telephone: " . $_POST['country_code, area_code, 3_digits, 4_digits']. "\n"; <---This is where I think I'm going wrong with my code.
$msg.="Payment Type" . $_POST['Payment Type']. "\n";
$msg.="Card Number and Security Code: " . $_POST['card_number, security_code']. "\n";
$msg.="Expiration Date Month and Year: " . $_POST['month, year']. "\n";

Any ideas?

-Spence
ryanlwh
Forum Commoner
Posts: 84
Joined: Wed Sep 14, 2005 1:29 pm

Post by ryanlwh »

Code: Select all

$msg.="Telephone: " .$_POST['country_code']."(".$_POST['area_code'].")-".$_POST['3_digits']."-".$_POST['4_digits']. "\n";
Each of the elements in $_POST are separated indexes. You cannont combine them into a gigantic index.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

WithHisStripes, please use

Code: Select all

or

Code: Select all

tags where appropriate when posting code. Read the first link in my signature if you need further details..
imc1975
Forum Newbie
Posts: 3
Joined: Fri Sep 16, 2005 3:16 pm

another advice...

Post by imc1975 »

ryanlwh wrote:

Code: Select all

$msg.="Telephone: " .$_POST['country_code']."(".$_POST['area_code'].")-".$_POST['3_digits']."-".$_POST['4_digits']. "\n";
Each of the elements in $_POST are separated indexes. You cannont combine them into a gigantic index.
try to use the isset() function, in case that values in the form were left empty:

$msg.="Telephone: " .isset($_POST['country_code'])?$_POST['country_code']:''."(".$_POST['area_code'].")-".$_POST['3_digits']."-".$_POST['4_digits']. "\n";

I wrote only the first, left up to you the others...


feyd | if you intend to post using bbcode, make sure it's on
WithHisStripes
Forum Contributor
Posts: 131
Joined: Tue Sep 13, 2005 7:48 pm

Post by WithHisStripes »

Hey guys, maybe I'm just overlooking something but I tried both ways and got nothing. Any more ideas? If you go to http://www.hookweb.net/testing/email_form.zip than you can download both files and tell me what I'm missin.
-Spence
Post Reply