как мога да направя задължителни полетата в това
');"/></p>
<p>
<label></label>
</p></td>
</tr>
<tr>
<td align="center">
<textarea rows="7" cols="55" name="message"><?php if(isset($_POST['message'])) echo $_POST['message']; ?></textarea></td></tr>
<tr>
<td align="center"><input type="submit" name="submit" value="Добави" class="submit" />
<input type="hidden" name="submitted" value="TRUE" /></td></tr></table>
</form>[/code]
Код:
<meta http-equiv="content-type" content="text/html; charset=windows-1251" />
<html>
<head>
<script language="javascript" type="text/javascript">
</script>
</head>
</html>
<?php
include ("connect.php");
if(isset($_POST['submitted'])){
$title = stripslashes($_POST['title']);
$message = stripslashes($_POST['message']);
$name = "Guest";
if(empty($title)){
echo '<table align="center"><tr><td align="center"><a class="text">Вие трябва да въведете заглавие.</a></td></tr></table>';
}
if(empty($message)){
echo '<table align="center"><tr><td align="center"><a class="text">Вие трябва да въведете урок.</a></td></tr></table>';
}
else{
$query = "INSERT INTO lesson_posts (`title`,`author`,`post`,`date`,`category`) VALUES ('$title','$name','$message',NOW(),'$category')";
$result = mysql_query($query) or die(mysql_error());
if($result){
echo'<table align="center"><tr><td align="center"><a class="text">Урокът беше прибавен!</a></td></tr></table>';
}
else {
echo '<table align="center"><tr><td align="center"><a class="text">Моля, попълнете подходящата информация</a></td></tr></table>';
}
}
}
?>
<form method="post" name="addform">
<table align="center">
<tr></tr>
<tr>
<td align="left">
Заглавие:
<input type="input" name="title" size="25" maxlength="60" value="<?php if(isset($_POST['title'])) echo $_POST['title']; ?>" /></td></tr>
<tr></tr>
<tr>
<td align="center">
<p><input type="button" onclick="areatext('[b]Text[/b]');" value="BOLD" style="color:#FFF"/>
<input type="button" value="Italic" style="color:#FFF" onclick="areatext('[i]Text[/i]');"/>
<input type="button" value="Underline" style="color:#FFF" onclick="areatext('[u]Text[/u]');"/>
<input type="button" value="Color" style="color:#FFF" onclick="areatext('[color=]Text[/color]');"/>
<input type="button" value="Size" style="color:#FFF" onclick="areatext('[size=0]Text[/size]');"/>
<input type="button" value="Img" style="color:#FFF" onclick="areatext('[img]Address[/img]');"/>
<input type="button" value="Link" style="color:#FFF" onclick="areatext('[url=Address]Name[/url]');"/>
<input type="button" value="Code" style="color:#FFF" onclick="areatext('[code]
<p>
<label></label>
</p></td>
</tr>
<tr>
<td align="center">
<textarea rows="7" cols="55" name="message"><?php if(isset($_POST['message'])) echo $_POST['message']; ?></textarea></td></tr>
<tr>
<td align="center"><input type="submit" name="submit" value="Добави" class="submit" />
<input type="hidden" name="submitted" value="TRUE" /></td></tr></table>
</form>[/code]