Forums

PHP

This topic is locked

How to submit all fields of a form in PHP?

Posted 16 years ago
1
has voted
16 years ago Cole Brady posted:
I am in the process of designing a web page. However, I have hit a snag. I have created a page where I ask for name, email, phone, address, and which of the products I am offering that they would like more information on. My problem is not getting it to submit the e-mail, but instead being able to receive in the e-mail all the answers to all the fields.

My code now is:

<?php

$liftchair = $_POST['LIFT CHAIR'];
$scooter = $_POST['SCOOTER'];
$powerchair = $_POST['POWER CHAIR'];
$stairlift = $_POST['STAIR LIFT'];
$liftscarriers = $_POST['LIFTS / CARRIERS'];
$other = $_POST['OTHER'];
$otherspecify = $_POST['OTHER SPECIFY'];
$infoASAP = $_POST['INFO ASAP'];
$name = $_POST['NAME'];
$email = $_POST['E-MAIL'];
$areacode = $_POST['AREA CODE'];
$phone1 = $_POST['PHONE 1'];
$phone2 = $_POST['PHONE 2'];
$address1 = $_POST['ADDRESS 1'];
$address2 = $_POST['ADDRESS 2'];
$address3 = $_POST['ADDRESS 3'];

$subject = "WEBSITE E-MAIL";
$info = "NAME: ".$name;

mail(' cbrady123@comcast.net ', $subject, $info, 'LAFAYETTE MOBILITY & SERVICE');
echo "MAIL SENT";
?>

With this code. The only field that I receive is the person's name. What do I have to do to receive all the fields from "$liftchair" to "$address3"?

PLEASE HELP!!!

-CB

Replies

Replied 16 years ago
16 years ago Georgi Kralev replied:
Hi Cole,

You are including only person's name into the variable $info that you use for sending emails. Check the following line:
$info = "NAME: ".$name;

If you want to receive all the fields, you have to add the other values retrieved from POST array.
For example, the you can replace the above line with the following one:

$info = 'NAME: '.$name.' LIFT CHAIR: '.$liftchair.' SCOOTER :'.$scooter.' POWER CHAIR :'.$powerchair
.' STAIR LIFT :'.$stairlift.' LIFTS - CARRIERS :'.$liftscarriers.' OTHER :'.$other.' OTHER SPECIFY :'.$otherspecify
.' INFO ASAP :'.$infoASAP.' E-MAIL :'.$email.' AREA CODE :'.$areacode.' PHONE 1 :'.$phone1.' PHONE 2 :'.$phone2
.' ADDRESS 1 :'.$address1.' ADDRESS 2 :'.$address2.' ADDRESS 3 :'.$address3;

If you want to format the string differently, check the PHP manual section for strings:
www.php.net/manual/en/book.strings.php

I hope this helps.

<b>Note:</b> The above code is not tested. Therefore, it may contain syntax errors.

Regards,

Georgi Kralev

Homepage: gdkralev.googlepages.com
Replied 16 years ago
16 years ago Cole Brady replied:
Thank you very much I appreciate the help. I have been trying to figure that out forever.

I posted another topic wondering how to get line breaks in between each field.

Thanks again,

Cole
Replied 16 years ago
16 years ago Georgi Kralev replied:
No problem. I am glad that I could help.

I have also replied to your other topic:
dmxzone.com/forum/topic.asp?topic_id=41820

Regards,


Georgi Kralev

Homepage: gdkralev.googlepages.com

Reply to this topic