×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

PHP example - How do I create arrays in a HTML <form>?


PHP - How do I create arrays in a HTML <form>?

To get your <form> result sent as an array to your PHP script you name the <input>, <select> or <textarea> elements like this: 

<input name="catlist[]">
<input name="catlist[]">
<input name="catlist[]">
<input name="catlist[]">


Treat the received information in your PHP script like this:

$num_cat = count ($catlist);
	
for ($i = 0; $i < $num_cat; $i++) 
{
    ... $catlist[$i] ...

}

Category: PHP

 
<< Go back