views:

44

answers:

1
<td class="widht200">
<input type="text" name="agg" size="2" disabled="disabled"/> </td><td class="widht200">
<input type="text" name="agg" size="2" disabled="disabled"/></td><td class="widht200"> 
<input type="text" name="agg" size="2" disabled="disabled"/> </td><td class="widht200">
<input type="text" name="agg" size="2" disabled="disabled"/> </td><td class="widht200">
<input type="text" name="agg"  size="2" disabled="disabled"/> </td><td class="widht200">
<input type="text" name="agg"  size="2" disabled="disabled"/> </td><td class="widht200">
<input type="text" name="agg"  size="2" disabled="disabled"/> </td>

i have wrote the code like this.. so now.. i need to post this form.. and agg as an array in php code.. how can i do it..

i used..

$arr[] = $_POST['agg'];

but showed error...

+2  A: 

You want to add a the brackets within your html like so:

<input type="text" name="agg[]"  size="2" disabled="disabled"/>

Then just assign it within php like normal:

$arr = isset($_POST['agg']) ? $_POST['agg'] : array();

But you should always have some defined name for your data as you will not know what is what, try use like this:

<input type="text" name="agg[first]"  size="2" disabled="disabled"/>

then within php after you assign it you then can use $arr['first'];

RobertPitt
Notice: Undefined index: agg in C:\wamp\www\final\index.php on line 9 i got this error when trying the same thing...
siddhartha
Updated to fix that issue.
RobertPitt
you mean i need to update the php
siddhartha
No, I mean that I have updated the php code above to fix that error.
RobertPitt