|
Posted by Craig Morrison on 06/09/06 21:35
Bent Stigsen wrote:
> Craig Morrison wrote:
>> Bent Stigsen wrote:
>>> Craig Morrison wrote:
> [snip]
>>>> A form posts the value for D1 to a script, script looks for the value of
>>>> D1 and gets it. PHP raises a notice that D1 is undefined.
>>>>
>>>> I don't understand how I am getting the value that is posted to the
>>>> script if the index is undefined.
>>>>
>>>> Is it really that difficult for someone to explain this?
>>> Yes, because in all likelyhood, that is not what is happening.
>>>
>>> Arrays and forms are so commonly used that, if it was a bug then it would
>>> be reported all over the place.
>>>
>>>
>>> /Bent
>> I didn't say that it was a bug..
>>
>> I'd yell louder if I thought it was. :-)
>
> Sorry, if what you say is happening, really is happening, then it is a bug,
> and since you didn't take Markus seriously, I assumed you did think it was.
You shouldn't make assumptions, that is a fatal flaw. You assumed that I
didn't take his advice seriously. Don't jump to conclusions it makes you
look like a, well... That's another matter, read on..
>
>> But I am getting the correct value, as you can see from the follow up
>> that I posted which does a print_r..
>
> You must be doing something or making assumptions that you consider
> unimportant to tell, because it doesn't make sense. Are you sure you are
> not seeing the notice *before* submitting the form, or subsequently do a
> redirect, or do some fiddling with the _POST-array elsewhere?
I am not making any assumptions, just writing code according to the
documentation. I gave the HTML that posts its results already..
These are the first 3 lines of the script that gets posted to..
<?
include 'inc/config.inc.php';
?>
The notice is generated in config.inc.php, which follows...
<?
// define query titles
$id_text[1]="Group Total Sent & Received";
$id_text[2]="EU Total Sent & Received";
$id_text[3]="EU Total Sent";
$id_text[4]="EU Total Received";
$id_text[5]="EU Sent By User";
$id_text[6]="EU Received By User";
$id_text[7]="US Total Sent & Received";
$id_text[8]="US Total Sent";
$id_text[9]="US Total Received";
$id_text[10]="US Sent By User";
$id_text[11]="US Received By User";
$id_text[12]="All Domains";
// define view names
$id_view[1]="GroupTotal";
$id_view[2]="EUTotal";
$id_view[3]="EUAllSent";
$id_view[4]="EUAllRcvd";
$id_view[5]="EUSent";
$id_view[6]="EURcvd";
$id_view[7]="USTotal";
$id_view[8]="USAllSent";
$id_view[9]="USAllRcvd";
$id_view[10]="USSent";
$id_view[11]="USRcvd";
$id_view[12]="AllDomainsTotal";
// define column styles
$fc_col_styles['TOTAL'] = 'no';
$fc_col_styles['Total'] = 'no';
$fc_col_styles['SENT'] = 'no';
$fc_col_styles['Sent'] = 'no';
$fc_col_styles['RCVD'] = 'no';
$fc_col_styles['Rcvd'] = 'no';
$fc_col_styles['Month'] = 'mo';
$fc_col_styles['MONTH'] = 'mo';
$fc_col_styles['User'] = 'us';
$fc_col_styles['USER'] = 'us';
$fc_col_styles['MBytes'] = 'mb';
$fc_col_styles['MBYTES'] = 'mb';
// set default values
$id_text_count = 12;
$id_option = 1;
// determine what view we are querying
if ($_SERVER['REQUEST_METHOD'] == 'POST')
$id_option = $_POST['D1']; // <=== DING we have winner, notice gets raised
else if ($_SERVER['REQUEST_METHOD'] == 'GET')
$id_option = $_GET['D1'];
if (($id_option == 0) || ($id_option > $id_text_count)) {$id_option = 1;}
$selectID = $id_view[$id_option];
?>
As you can see, there is nothing but good php there.
Now, here's where I get pissed off. You all assumed that I was just
pissing in the wind. I gave a good explanation of what I was doing
before and this code tells you nothing more.
Next time, ask for answers before being an ass and assuming you are
working with a n00b..
Craig
Navigation:
[Reply to this message]
|