php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9924 Warning: Undefined index: Service[1]
Submitted: 2001-03-22 09:57 UTC Modified: 2001-03-23 08:14 UTC
From: john at neutralize dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.0.4pl1 OS: Windows 98
Private report: No CVE-ID: None
 [2001-03-22 09:57 UTC] john at neutralize dot com
I am dynamically creating input fields in my form with their values stored in an array:

<input type="Hidden" name=Service[<?php echo $counter ?>] value=<?php echo odbc_result($result, "ServiceId") ?>>

These submit fine but I am having trouble accessing the results of the array from the post variables:

$serviceId = $HTTP_POST_VARS["Service[".$counter."]"];

Do I need to use unicode decompression before referencing the variables or am I just building the reference wrong?

Have looked at PHP help but only tells you how to use arrays in form variables not how to retrieve them.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-22 10:14 UTC] hholzgra@php.net
i would suggest that you put qoutes arround *all*
tag attribute values:

<input 
  type="Hidden" 
  name="Service[<?php echo $counter ?>]"
 value="<?php echo odbc_result($result, 'ServiceId')?>"
>

and you could use var_dump($HTTP_POST_VARS) 
and the generated HTML code to further analyse 
the cause of the problem?
 [2001-03-23 08:14 UTC] sniper@php.net
send twice.. (#9926)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 04:01:27 2024 UTC