我正在尝试使用下拉列表使此代码工作。 strip_tags
是否可能不适用于下拉列表?如果任何人可以帮助我,那将是非常有帮助的
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"> </script>
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
</head>
<body>
<span id="spryselect1">
<label>
<form method="post" action="b.php">
<select name="s" id="s">
<option value="friends" selected>Friends</option>
<option value="search">Search engine</option>
<option value="ad">Advertisement</option>
<option value="other">Other</option>
</select>
<div class="col span-2-of-3">
<input type="submit" value="Send it!">
</div>
</form>
</label>
<span class="selectRequiredMsg">Please select an item.</span></span>
<script type="text/javascript">
<!--
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
//-->
</script>
</body>
PHP
<?php
include_once('connection.php');
$s=strip_tags($_POST['s']);
if (@$_POST['submit'])
{
$queryreg = mysql_query("
INSERT INTO p VALUES ('$s')
");
}
else
echo "Not done";
?>