/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] php form question

is there an array or anything that collects all the elements submitted by a form? the idea i’m thinking of is, although maybe unpractical, that an array or something that each index would be the order of the item on the form

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMar 17.2008 — Do you mean like the $_POST, $_GET, and/or $_REQUEST super-global arrays?

http://www.php.net/manual/en/language.variables.external.php
Copy linkTweet thisAlerts:
@ixxalnxxiauthorMar 17.2008 — in order to use those, you must know the name for each item in the form. what i'm looking for is an array that builds of the forms so that i can just do [code=php]echo $array[0]; [/code] which would point to the first item in the submitted form without have to know it's field name
Copy linkTweet thisAlerts:
@NogDogMar 17.2008 — I don't know why that matters. If you want to loop through the $_POST array, just use a foreach() loop. If you want a list of the field names, do [b]$names = array_keys($_POST);[/b]. If you really, really feel you just [i]have[/i] have to work with an enumerated array for some odd reason, then [b]$formValues = array_values($_POST);[/b].
Copy linkTweet thisAlerts:
@ixxalnxxiauthorMar 17.2008 — foreach ($_POST as $value) {

echo "$value<br />n";

}

prob solved

edit: didnt see your post above me one.. should refresh this page often o_O
×

Success!

Help @ixxalnxxi 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 5.17,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...