Custom HTML Array Index
Posted: Wed Jun 06, 2007 4:16 pm
Good Day
I would like to know how to change the html array index from the default value starting at 0 to a custom description.
For example, I have multiple text boxes that look like this
When iterating through the submitted results
It outputs
I did try this
But it still outputs the same results.
I also tried to find some examples on google to no avail. There are many examples of the default array, but not regarding the changing of the index.
I would like to know how to change the html array index from the default value starting at 0 to a custom description.
For example, I have multiple text boxes that look like this
Code: Select all
<input type="text" id="vtl_intf_logicalpath[1]" name="vtl_intf_logicalpath[1]" value="00" size="2" maxlength="2" tabindex="9" class="swifttext" >Code: Select all
foreach ($_REQUEST["vtl_intf_logicalpath"] as $logical_id => $logical_value)
{
echo "\$logical_id:$logical_id<br>";
echo "\$logical_value:$logical_value<br>";
} // foreach ($_REQUEST["vtl_intf_logicalpath"] as $logical_id => $logical_value)I would like to change the array index ($logical_id) to another value starting from a custom number instead of 0$logical_id:0
$logical_value:00
$logical_id:1
$logical_value:01
$logical_id:2
$logical_value:02
I did try this
Code: Select all
<input type="text" id="vtl_intf_logicalpath[1=>1]" name="vtl_intf_logicalpath[1=>1]" value="00" size="2" maxlength="2" tabindex="9" class="swifttext" >I also tried to find some examples on google to no avail. There are many examples of the default array, but not regarding the changing of the index.