why error message on this form code below 
Author Message
 why error message on this form code below

why error messages on  this form code below:

Code
============
$Method = (isset($HTTP_POST_VARS)) ? "Post" : "Get";
if($Method == "Post"){
 $year=$_POST['y'];
 $month=$_POST['m'];

Quote:
}

ERR msgs
================
Notice: Undefined index: y in C:\Inetpub\wwwroot\.....   on line 37
Notice: Undefined index: m in C:\Inetpub\wwwroot\.....  on line 38


Wed, 18 May 2005 08:38:54 GMT  
 why error message on this form code below
problem found
Quote:

>why error messages on  this form code below:

>Code
>============
>$Method = (isset($HTTP_POST_VARS)) ? "Post" : "Get";
>if($Method == "Post"){
> $year=$_POST['y'];
> $month=$_POST['m'];
>}

>ERR msgs
>================
>Notice: Undefined index: y in C:\Inetpub\wwwroot\.....   on line 37
>Notice: Undefined index: m in C:\Inetpub\wwwroot\.....  on line 38



Wed, 18 May 2005 08:48:06 GMT  
 why error message on this form code below

Quote:

> problem found


>>why error messages on  this form code below:

>>Code
>>============
>>$Method = (isset($HTTP_POST_VARS)) ? "Post" : "Get";
>>if($Method == "Post"){
>> $year=$_POST['y'];
>> $month=$_POST['m'];
>>}

>>ERR msgs
>>================
>>Notice: Undefined index: y in C:\Inetpub\wwwroot\.....   on line 37
>>Notice: Undefined index: m in C:\Inetpub\wwwroot\.....  on line 38

Try using
if (array_key_exists("y", $_POST))
{
...

Quote:
}

If you use error_reporting(E_ALL), this kind of thing comes up, but
it's better to catch the errors, especially if you or others are going to reuse


Wed, 18 May 2005 09:29:45 GMT  
 why error message on this form code below
thanks I'll try this

but I have another issue now.
When I collect the form value which is a year from a droplist.
PHp yields  an integer instead of the year

It did this even with the other post test format I was using before.

//////////my code to get form value ////////

if (array_key_exists("y", $_POST)){
 $year=$_POST['y'];
 $month=$_POST['m'];

echo ('$year= '.$_POST['y']);  //this yields some integer value

Quote:
}

//////value returned ///////

$year= 10

//////my droplist ///////

<SELECT name="y">
<OPTION value=2002 selected >2002</OPTION>
<OPTION value=2003  >2003</OPTION>
<OPTION value=2004  >2004</OPTION>
<OPTION value=2005  >2005</OPTION>
</SELECT>

 what's happening here  there's no 10 in my droplist

Quote:


> problem found


>>why error messages on  this form code below:

>>Code
>>============
>>$Method = (isset($HTTP_POST_VARS)) ? "Post" : "Get";
>>if($Method == "Post"){
>> $year=$_POST['y'];
>> $month=$_POST['m'];
>>}

>>ERR msgs
>>================
>>Notice: Undefined index: y in C:\Inetpub\wwwroot\.....   on line 37
>>Notice: Undefined index: m in C:\Inetpub\wwwroot\.....  on line 38

Try using
if (array_key_exists("y", $_POST))
{
...

Quote:
}

If you use error_reporting(E_ALL), this kind of thing comes up, but
it's better to catch the errors, especially if you or others are going to
reuse


Wed, 18 May 2005 12:50:30 GMT  
 why error message on this form code below

Quote:
> //////////my code to get form value ////////
> echo ('$year= '.$_POST['y']);  //this yields some integer value
> //////value returned ///////
> $year= 10
> //////my droplist ///////
> <SELECT name="y">
> <OPTION value=2002 selected >2002</OPTION>
> <OPTION value=2003  >2003</OPTION>
> </SELECT>
>  what's happening here  there's no 10 in my droplist

I don't know, seems quite odd, but I would try adding the ""'s to the
option values:
<option value="2002" selected> 2002</option> etc.

One obvious guess would be (can't check without access to actual form)
that you have named the month selection "y" also...

HTH,
    Hannu



Fri, 20 May 2005 18:29:00 GMT  
 why error message on this form code below
thanks for the reply

it was a problem of using a name='y'
I changed it to 'yr' and problem solved

Quote:

>> //////////my code to get form value ////////
>> echo ('$year= '.$_POST['y']);  //this yields some integer value

>> //////value returned ///////
>> $year= 10

>> //////my droplist ///////
>> <SELECT name="y">
>> <OPTION value=2002 selected >2002</OPTION>
>> <OPTION value=2003  >2003</OPTION>
>> </SELECT>

>>  what's happening here  there's no 10 in my droplist

>I don't know, seems quite odd, but I would try adding the ""'s to the
>option values:
><option value="2002" selected> 2002</option> etc.

>One obvious guess would be (can't check without access to actual form)
>that you have named the month selection "y" also...

>HTH,
>    Hannu



Sat, 21 May 2005 18:06:57 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Form opening below browse

2. Lack of error messages during Tk startup - why?

3. why is this error message comming up?

4. Why is error message value "disappearing"?

5. Lack of error messages during Tk startup - why?

6. canvas find below x - segmentation error

7. tcl8.0 fails to compile using unix (see below for error)

8. No error message despite illegal code

9. Why do I get Load Error code 8 from Labview

10. why do i get error code -2147024891?

11. why the code error?

12. why why why oh why why baby

 

 
Powered by phpBB® Forum Software