Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
PHP
« Previous
Next »
How do I create PHP arrays in a HTML <form>?
Options
- < input name= MyArray[]/>
- < input ="MyArray[]" />
- < input name="MyArray[]" />
- < input MyArray[] />
CORRECT ANSWER : < input name="MyArray[]" />
Discussion Board
HELLO
Welciome to the world.
sagar 01-16-2024 08:04 AM
x
< input name="MyArray[]" />
kamal vasant sawant 11-26-2021 05:32 AM
Re: php array
duy, normally when submitting a form all of the "input" or "select" objects need to have a unique name so you can tell which is which... However, imagine you want a number of related checkboxes where one might be true, or even all of them!... For instance, you can own a Motorbike, a Car and a Boat, all of which are forms of transport...
If you gave all of those different names you would need to do some more convoluted checking to see which of them are set, (Is Transport1 set? Transport2? Transport3? etc..) but if you give them all the same name but ending in square brackets (I.E. name="Transport[]") PHP will take all of the given answers and turn them into an array automatically, allowing you to do things like loop through each element of it. (In the code that the form posts to)
Daniel 06-2-2015 10:18 PM
PHP Arrays
Answer : < input name="MyArray[]"/>
Jayesh Sonar 02-10-2015 03:58 AM
a
like select input
Anvis 01-13-2015 08:27 AM
php array
I can't get the point. Never see it before. Can someone explain it please?
duy 08-7-2014 12:51 AM
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
PHP (39)
DHTML (10)
CSS (21)
MySQL (20)
VLSI (9)
XML (28)
UML (11)
HTML (19)
Fedora (61)
HTML5 (60)
Android (100)
Advertisement
▲