您的位置:首页 > 其它

CH7--数组,p128,练习二

2016-12-19 16:47 141 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<title>应用explode()函数添加多选题</title>
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>

<body>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="">
<table width="400" border="1" cellpadding="0" cellspacing="1" bordercolor="#FF9900" bgcolor="#CCFF66">
<tr align="center">
<td height="36">多选题目:</td>
<td height="36" align="left"><p>
<input name="title" type="text" id="title" size="32">
</p></td>
<td height="36"> </td>
</tr>
<tr align="center">
<td width="98" height="120">添加多选题:</td>
<td width="223" height="120"><p>
<textarea name="content" cols="30" rows="5" id="content"></textarea>
<br>
<span class="style1">注意:每个选项间用*分隔符</span></p></td>
<td width="61" height="120"><input type="Submit" name="Submit" value="提交"></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td>
<?php
if(@$_POST[Submit]!=""){
?>
<table width="400" border="1" cellpadding="0" cellspacing="1" bordercolor="#FF9900" bgcolor="#CCFF66">
<tr align="center">
<td width="98" height="30"><?php echo @$_POST[title];?></td>
<td width="223" height="30">
<?php
$content=@$_POST[content];
$data=explode("*",$content);
while(list($name,$value)=each($data)){
echo '<input type="checkbox" name="checkbox" value="checkbox">';
echo $value."\n";
}
?>
</td>
<td width="61" height="30"> </td>
</tr>
</table></td>
</tr>
</table>
<?php
}
?>
<p> </p>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: