PHP use of array in form ?

By November 4, 2011 PHP

Here is a simple example how to use array in html form element to store multiple value under single name.
<title>Use of array in form</title>
<h1>Use of array in form</h1>

your favourite artists:
echo implode($_REQUEST['artists']," , ");

<form method="post">
Select your favourite artists: <br />
<select name="artists[]" multiple="true">
<option value="Amitabh Bachan">Amitabh Bachan</option>
<option value="Shahrukh Khan">Shahrukh Khan</option>
<option value="Aamir Khan">Aamir Khan</option>
<option value="Salman Khan">Salman Khan</option>
<option value="Ajay Devgan">Ajay Devgan</option>
<input type="submit" name="submit" value="Submit" />




Leave a Reply

5 + 3 =