|  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.


Add a Patch

Pull Requests

Add a Pull Request


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

  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]
send twice.. (#9926)

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jun 25 13:05:46 2022 UTC