PHP Printing Error Help
7 answers - 513 bytes -

Hi Guys,
I am new to PHP coding but that is no excuse for the mess I am making here.
The ideal page for my needs is:
(Simple form in PHP where all form values are mailed)
I could not make the CHECK BX work in PHP page so tried in this HTM page.
I prints out part of the PHP code itself.
Can anyone PLEASE tell me "where" I am making a buffoon of myself?
I am a designer who is trying to understand the language so do pardon my ignorance.
Thanks,
C
No.1 | | 459 bytes |
| 
Chirantan Ghosh wrote:
Hi Guys,
I am new to PHP coding but that is no excuse for the mess I am making here.
The ideal page for my needs is:
(Simple form in PHP where all form values are mailed)
I could not make the CHECK BX work in PHP page so tried in this HTM page.
I prints out part of the PHP code itself.
What isn't working with the check boxes? How are you retrieving the
values upon processing the form?
No.2 | | 1791 bytes |
| 
Ho 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 R why
is it repeated in the "Comments" section.
The page is you can
see the source code if you like.
Thanks a lot for the input,
C
Message
From: "John Nichel" <john (AT) kegworks (DOT) com>
To: <php-general (AT) lists (DOT) php.net>
Sent: Monday, August 15, 2005 12:31 PM
Subject: Re: [PHP] PHP Printing Error Help
Chirantan Ghosh wrote:
>Hi Guys,
>>
>I am new to PHP coding but that is no excuse for the mess I am making
>here.
>>
>The ideal page for my needs is:
>
>(Simple form in PHP where all form values are mailed)
>>
>I could not make the CHECK BX work in PHP page so tried in this HTM
>page.
>It prints out part of the PHP code itself.
>
>
What isn't working with the check boxes? How are you retrieving the
values upon processing the form?
No.3 | | 1645 bytes |
| 
Chirantan Ghosh wrote:
Ho 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 R
why is it repeated in the "Comments" section.
The page is 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-HMECASH" and
"1-877-APPLY NW", 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-HMECASH">
<input type="checkbox" name="InterestedNumber[]" value="1-877-APPLY NW">
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.
No.4 | | 3574 bytes |
| 
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-HMECASH">
/////////////[/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_PST_VARS as $indx =$value) {
${$indx}=$value;
}
if($sendmessage == "yes"){
$todaytime = date("F j, Y, g:i a");
$mailTo = "cghosh (AT) primarywave (DOT) 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 (AT) primarywavemedia (DOT) 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
Thanks for the help,
C
Message
From: "John Nichel" <john (AT) kegworks (DOT) com>
To: <php-general (AT) lists (DOT) 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////
>$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 R
>why is it repeated in the "Comments" section.
>>
>The page is 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-HMECASH" and
"1-877-APPLY NW", 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-HMECASH">
<input type="checkbox" name="InterestedNumber[]" value="1-877-APPLY NW">
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.
No.5 | | 1257 bytes |
| 
Mon, August 22, 2005 12:56 pm, Chirantan Ghosh wrote:
//////////////[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-HMECASH">
/////////////[/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_PST_VARS as $indx =$value) {
${$indx}=$value;
}
Gak.
If you are going to do this, you might as well just turn
register_globals back ""
You've got the SAME security problem -- You just are doing it to
yourself instead of letting PHP do it to you.
if($sendmessage == "yes"){
$mailBody .= "SelectedNumber: $SelectedNumber\n"; //////I am
thinking this
is where I should put the Array?/////
$mailBody .= "SelectedNumbers:\n";
$mailBody .= implode("\n", $InterestedNumbers);
$mailBody .= "Comments: $comments\n\n\n";
No.6 | | 2150 bytes |
| 
Hi Richard,
I am new as you can assume. Hence, I have no clue how to turn
register_globals back ""
////////////////Is there any other place I can read more about creating
Arrays? other than
The page is discussion:
doesn't seem to send
the email even
Can you please shed some light?
Thanks,
C
Message
From: "Richard Lynch" <ceo (AT) l-i-e (DOT) com>
To: "Chirantan Ghosh" <cghosh (AT) primarywave (DOT) com>
Cc: "John Nichel" <john (AT) kegworks (DOT) com>; <php-general (AT) lists (DOT) php.net>
Sent: Tuesday, August 23, 2005 2:00 AM
Subject: Re: [PHP] PHP Printing Error Help
Mon, August 22, 2005 12:56 pm, Chirantan Ghosh wrote:
>//////////////[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-HMECASH">
>/////////////[/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_PST_VARS as $indx =$value) {
>${$indx}=$value;
>}
>
Gak.
If you are going to do this, you might as well just turn
register_globals back ""
You've got the SAME security problem -- You just are doing it to
yourself instead of letting PHP do it to you.
>
>if($sendmessage == "yes"){
>>
>$mailBody .= "SelectedNumber: $SelectedNumber\n"; //////I am
>thinking this
>is where I should put the Array?/////
>
$mailBody .= "SelectedNumbers:\n";
$mailBody .= implode("\n", $InterestedNumbers);
>
>$mailBody .= "Comments: $comments\n\n\n";
>
No.7 | | 2624 bytes |
| 
Hi Richard ,
Jay helped me with the Global setting but the problem remains the same. Can
you enlighten please?
/////////[snip]
If you are going to do this, you might as well just turn
register_globals back ""
You've got the SAME security problem -- You just are doing it to
yourself instead of letting PHP do it to you.
/////////[/snip]
Apparently the register_globals is ""
My site's PHP info is available at
The problem still in hand is:
////[snip]
a different Note,
This page is the original working version I have:
This is the page I want to work allowing the check box values to be
reported.
I kept almost everything identical so Im at loss why the 2nd doesn't even
send the email
////[snip]
Thanks,
C
Message
From: "Richard Lynch" <ceo (AT) l-i-e (DOT) com>
To: "Chirantan Ghosh" <cghosh (AT) primarywave (DOT) com>
Cc: "John Nichel" <john (AT) kegworks (DOT) com>; <php-general (AT) lists (DOT) php.net>
Sent: Tuesday, August 23, 2005 2:00 AM
Subject: Re: [PHP] PHP Printing Error Help
Mon, August 22, 2005 12:56 pm, Chirantan Ghosh wrote:
>//////////////[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-HMECASH">
>/////////////[/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_PST_VARS as $indx =$value) {
>${$indx}=$value;
>}
>
Gak.
If you are going to do this, you might as well just turn
register_globals back ""
You've got the SAME security problem -- You just are doing it to
yourself instead of letting PHP do it to you.
>
>if($sendmessage == "yes"){
>>
>$mailBody .= "SelectedNumber: $SelectedNumber\n"; //////I am
>thinking this
>is where I should put the Array?/////
>
$mailBody .= "SelectedNumbers:\n";
$mailBody .= implode("\n", $InterestedNumbers);
>
>$mailBody .= "Comments: $comments\n\n\n";
>