Here is a simple example how to use array in html form element to store multiple value under single name.<html>
<head>
<title>Use of array in form</title>
</head><body>
<h1>Use of array in form</h1>
<?php
if(isset($_REQUEST['artists'])){
?>
your favourite artists:<?php
echo implode($_REQUEST['artists']," , ");
}
else
{
?><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>
</select<
<input type="submit" name="submit" value="Submit" />
</form><?php
}
?>
</body>
</html>
Introduction Learning has been transformed by artificial intelligence, which provides resources that enable you to…
Introduction Even experienced developers may find it difficult to create aesthetically pleasing and useful web…
Introduction Git tags are an essential feature of version control systems, offering a simple way…
Introduction The methods that browsers employ to store data on a user's device are referred…
Introduction A well-known open-source VPN technology, OpenVPN provides strong protection for both people and businesses.…
Introduction Integrating Sentry into a Node.js, Express.js, and MongoDB backend project significantly enhances error tracking…