дело в том:у мя есть поля которые надо заполнять если не заполняешь объявление не добавляется, когда я добавляю код защиты от "< >" проверка заполнение не работает?в чем проблема плиз помогите
PHP код:
<?php
include("block/bd.php");
if (isset($_POST['title'])) {$title = $_POST['title']; if ($title == ''){unset($title);}}
if (isset($_POST['meta_d'])) {$meta_d = $_POST['meta_d'];if ($meta_d == ''){unset($meta_d);}}
if (isset($_POST['date'])) {$date = $_POST['date'];if ($date== ''){unset($date);}}
if (isset($_POST['description'])) {$description = $_POST['description'];if ($description == ''){unset($description);}}
if (isset($_POST['text'])) {$text= $_POST['text'];if ($text == ''){unset($text);}}
if (isset($_POST['author'])) {$author= $_POST['author'];if ($author == ''){unset($author);}}
if (isset($_POST['submit'])) {$submit= $_POST['submit'];}
if (isset($submit))
{
if (isset($title)) {trim($title); }
else {$title="";}
if (isset($meta_d)) {trim($meta_d); }
else {$meta_d="";}
if (isset($date)) {trim($date); }
else {$date="";}
if (isset($description)) {trim($description); }
else {$description="";}
if (isset($text)) {trim($text); }
else {$text="";}
if (isset($author)) {trim($author); }
else {$author="";}
}
$title = stripslashes($title);
$meta_d = stripslashes($meta_d);
$date = stripslashes($date);
$description = stripslashes($description);
$author = stripslashes($author);
$text = stripslashes($text);
$title = htmlspecialchars($title);
$meta_d = htmlspecialchars($meta_d);
$date = htmlspecialchars($date);
$description = htmlspecialchars($description);
$author = htmlspecialchars($author);
$text = htmlspecialchars($text);
?>
<?php ?>
<HTML>
<HEAD>
<TITLE>обработ</TITLE>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
.style7 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
}
.style8 {
font-size: 12px;
color: #666666;
}
.style11 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
}
.style12 {
font-size: 12px;
font-weight: bold;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></HEAD>
<BODY LINK="#464545" ALINK="#9fb5b5" vlink="#666666">
<style type="text/css">
A {
text-decoration: none;
}
A:hover {
color: #5a8f96;
}
</style>
<TABLE width="980" cellpadding="0" cellspacing="0">
<!--шапка сайта-->
<?php include("block/head.php");?>
</table>
<table width="980" cellspacing="0" cellpadding="0" background="bg.jpg">
<tr>
<td width="100" height="100" valign="top" rowspan="3" bgcolor="#ffffff">
<table cellspacing="0" cellpadding="0" width="185" height="142">
<tr>
<!--меню сайта-->
<?php include("block/menu.php");?>
</tr>
</table> </td>
<td width="795" height="110" colspan="2" align="center" valign="middle" background="img/Downhead.jpg"><table width="177" height="52" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="177" scope="col"><a href="new_add_ob.php"><span class="style8">-->Добавить объявление</span></a></th>
</tr>
</table> </td>
</tr>
<tr>
<td width="673" height="400" align="left" valign="top" bgcolor="#ffffff" class="style7">
<p class="style7"><?php
if ((isset($title)) and (isset($meta_d)) and (isset($date)) and (isset($description)) and (isset($text)) and (isset($author)))
{
$azat =mysql_query ("INSERT INTO obiav (title,meta_d,date,description,text,author) VALUES('$title','$meta_d','$date','$description','$text','$author')");
if ($azat == "true") {echo "<p>объявление добавлена</p>";}
else {echo "<p>объявление не добавлена</p>";}
}
else
{
echo ("<p>Вы ввели не всю информацию <br><input name='back' type='button' value='Вернуться назад' onclick='javascript:self.back();'></p>");
}
?></p></td>
<!--правый край-->
<?php include("block/pravkr.php");?>
</tr>
<!--после текста-->
<?php include("block/dopodvl.php");?>
<!--нижняя часть-->
<?php include("block/podval.php");?>
</TABLE>
</BODY>
</HTML>