Re: PHP Printing Error Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx";
....
$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@xxxxxxxxxxxxxxxxxxxx\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@xxxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Monday, August 15, 2005 12:58 PM
Subject: Re:  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////
$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

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@xxxxxxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux