例子:Multiple Selection
类别: PHP教程
<?php
function php_self2url(){
global $PHP_SELF;
$tmp = eregi_replace("%2f","/",urlencode($PHP_SELF));
return $tmp;
}
?>
<form action="<?php echo php_self2url();?>" method="post">
<p>What do you like :<select size="5" name="yourlike[]" multiple>
<option value="sports">sports</option>
<option value="pet">pet</option>
<option value="violin">violin</option>
<option value="sleep">sleep</option>
<option value="music">music</option>
<option value="eat">eat</option>
</select></p>
<input type="submit">
</form>
<?php
if(isset($yourlike)){
$count = count($yourlike);
echo "<h1>Your like is:<br>";
for($i=0;$i<$count;$i++){
echo " " . $yourlike[$i]."<br>";
}
}
?>
function php_self2url(){
global $PHP_SELF;
$tmp = eregi_replace("%2f","/",urlencode($PHP_SELF));
return $tmp;
}
?>
<form action="<?php echo php_self2url();?>" method="post">
<p>What do you like :<select size="5" name="yourlike[]" multiple>
<option value="sports">sports</option>
<option value="pet">pet</option>
<option value="violin">violin</option>
<option value="sleep">sleep</option>
<option value="music">music</option>
<option value="eat">eat</option>
</select></p>
<input type="submit">
</form>
<?php
if(isset($yourlike)){
$count = count($yourlike);
echo "<h1>Your like is:<br>";
for($i=0;$i<$count;$i++){
echo " " . $yourlike[$i]."<br>";
}
}
?>
-= 资 源 教 程 =-
文 章 搜 索