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
Need help fixing a mailto form...
Moderator: General Moderators
-
WithHisStripes
- Forum Contributor
- Posts: 131
- Joined: Tue Sep 13, 2005 7:48 pm
Code: Select all
$msg.="Telephone: " .$_POST['country_code']."(".$_POST['area_code'].")-".$_POST['3_digits']."-".$_POST['4_digits']. "\n";- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
WithHisStripes, please use
Code: Select all
orCode: Select all
tags where appropriate when posting code. Read the first link in my signature if you need further details..another advice...
try to use the isset() function, in case that values in the form were left empty:ryanlwh wrote:Each of the elements in $_POST are separated indexes. You cannont combine them into a gigantic index.Code: Select all
$msg.="Telephone: " .$_POST['country_code']."(".$_POST['area_code'].")-".$_POST['3_digits']."-".$_POST['4_digits']. "\n";
$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
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
-Spence