/    Sign up×
Community /Pin to ProfileBookmark

Question about HTML and PHP Arrays

[code=php]echo ‘<td><input name=”id[]” type=”text” size=”5″ value =” ‘ . $pending[‘id’] . ‘ ” /></td> ‘;
echo ‘<td><input name=”id[]” type=”text” size=”20″ value =” ‘ . $pending[‘cds’] .’ “/></td> ‘;[/code]

it produces this:
(
[0] => 2007
[1] => 12
[2] => 3434
[3] => 67
)

i want something like this:
Array
(
[0] => Array
(
[0] => 2007
[1] => 12
)
[1] => Array
(
[0] => 3434
[1] => 67
)
)

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 28.2008 — You could do:
<i>
</i>&lt;input name="id[0][]" . . . &gt;
&lt;input name="id[0][]" . . . &gt;
&lt;input name="id[1][]" . . . &gt;
&lt;input name="id[1][]" . . . &gt;
Copy linkTweet thisAlerts:
@sc908authorAug 28.2008 — Not quite i suppose.here is more info:

the id and cds gets pulled from the database. I then want to create and array like this where one entry of the id and cd produces this:

[0] => Array

(

[0] => 2007

[1] => 12

)

then the next entry:

[1] => Array

(

[0] => 3434

[1] => 67

)

and so on

When i try that code, it generates two separate arrays and not one combine one
×

Success!

Help @sc908 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...