Page 1 of 1

Very simple question about HTTP Request

Posted: Wed Jun 25, 2003 10:15 am
by berniecc
How can I retrieve, in a server side php, the selected options of a multiple select? i mean, could you specify a simple code to do it?

Thanx in advance.
Bernie.

Posted: Wed Jun 25, 2003 10:38 am
by volka

Code: Select all

<html>
	<head><title>example</title></head>
	<body>
		<pre><?php if (isset($_POST['multisel'])) print_r($_POST['multisel']); ?></pre>
		<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
			<select name="multisel[]" multiple="multiple">
				<option>a</option>
				<option>b</option>
				<option>c</option>
				<option>d</option>
				<option>e</option>
			</select>
			<input type="submit" />
		</form>
	</body>
</html>
the import part is [] appended to the name property of <select>