21,887
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form method="post" action="newsAction.php">
<p>
<laber>标题:</laber><input type="text" name="title"/>
</p>
<p>
<laber>内容:</laber><textarea name="content" rows="5" cols="40"></textarea>
</p>
<input type="hidden" name="act" value="add"/>
<input type="submit" value="提交"/>
</form>
</body>
</html>
<?php
header('content-type:text/html; utf-8');
$act=$_POST['act'];
$title=trim($_POST['title']);
$content=$_POST['content'];
echo $title;
?>
<?php
function html2txt($document){
$search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments including CDATA
);
$text = preg_replace($search, '', $document);
return $text;
}
$act=html2txt($_POST['act']);
$title=html2txt($_POST['title']);
$content=html2txt($_POST['content']);
?>