Re: PHP Printing Error Help
| From: | Chirantan Ghosh | Date: | Mon, 22 Aug 2005 19:56:01 +0000 |
| Subject: | Re: PHP Printing Error Help | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-221114@lists.php.net to get a copy of this message | ||
Hi John,
//////////////[snip]
You probably want to move into the relm of array's. For each one of your checkboxes, you can do this... <input type="checkbox" name="InterestedNumber[]" value="1-877-HOMECASH"> /////////////[/snip]I did look up ARRAY. I just didn't understand how I can insert a table( "InterestedNumber") in an arrey so I could put something like this for form processing: ------------------------------------------------------ <? foreach($HTTP_GET_VARS as $indx => $value) { ${$indx}=$value; } foreach($HTTP_POST_VARS as $indx => $value) { ${$indx}=$value; } if($sendmessage == "yes"){ $todaytime = date("F j, Y, g:i a"); $mailTo = "cghosh@primarywave.com"; .... $mailBody .= "Main Activities: $activities\n\n"; $mailBody .= "SelectedNumber: $SelectedNumber\n"; //////I am thinking this is where I should put the Array??///// $mailBody .= "Comments: $comments\n\n\n"; $mailBody .= "$todaytime"; $mailHeaders = "From: contact@primarywavemedia.com\n"; mail($mailTo, $mailSubject, $mailBody, $mailHeaders); print "<CENTER><H2>Thank You</H2></CENTER>"; }else{ $_num = new number(); $_num->init(); $number = $_num->num_info[number]; ?> --------------------------------------------------- The PAGE I am testing is http://www.primarywave.com/BrokerOutpost_ContNAGHAM.php Thanks for the help, C ----- Original Message ----- From: "John Nichel" <john@kegworks.com> To: <php-general@lists.php.net> Sent: Monday, August 15, 2005 12:58 PM Subject: Re: [PHP] PHP Printing Error Help
Chirantan Ghosh wrote:Hi John, I put each check box with name & tried to get the values as I get of Name, etc. Somehow it didn't send that info so, now I tried to get the info of the whole TABLE named "InterestedNumber"(which contains all check boxes) <? //////after all codes////The "\n" is just a new line. Your checkboxes are all named things like "1-877-HOMECASH" and "1-877-APPLY NOW", so '$InterestedNumber' isn't going to have any of their values. You probably want to move into the relm of array's. For each one of your checkboxes, you can do this... <input type="checkbox" name="InterestedNumber[]" value="1-877-HOMECASH"> <input type="checkbox" name="InterestedNumber[]" value="1-877-APPLY NOW"> So on, and so forth. By naming them in this way, it will pass the value to your form processor as a numerical array of all the selected items. When you want to process it, just loop thru the array. http://us2.php.net/manual/en/language.types.array.php -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 john@kegworks.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php$mailBody .= "Full Name: $name\n";... $mailBody .= "Company Info: $Company Info\n"; $mailBody .= "Interested Numbers: $InterestedNumber\n"; $mailBody .= "Interested Area: $InterestedArea\n"; $mailBody .= "Comments: $comments\n\n\n"; $mailBody .= "$todaytime"; /////// THIS is where I put in the check box//// How ever the main problem for me is "Interested Numbers: $InterestedNumber\n"; part where I have no clue what "\n" stands for OR why is it repeated in the "Comments" section. The page is http://www.primarywave.com/BrokerOutpost_Contact.htm you can see the source code if you like. Thanks a lot for the input, C