I am newbie and trying to apply sanitizing function on "title" named particular variable in my form. but its not working. Even I am not getting any syntax problem. Please help me.
<?php
session_start();
include("config.php");
if(!isset($_SESSION["code"]))
{ $_SESSION["code"]=rand(1000,9999);
}
if(isset($_POST["submit"]));
{
$title=$_POST['title'];
$roman=$_POST['roman'];
$hindi=$_POST['hindi'];
$poet=$_POST['poet'];
$category=$_POST['category'];
//$title=trim($title);
$title = filter_var($title, FILTER_SANITIZE_STRING);
if($_SESSION["code"]==$code)
{ $sql= "INSERT into tbl_songlist_info(song_title,lyrics_roman,lyrics_hindi,poet_name,song_type) values('$title','$roman','$hindi','$poet','$category') ";
mysql_query($sql);
unset($_SESSION["code"]);
}
else{
$msg='Your Input code is not valid';
mysql_error();}
}
?>
<!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>
</head>
<body>
<form action="<?=$_SERVER['PHP_SELF'];?> " method="post" name="ghazal" id="ghazal">
<table width="461" border="0" align="center" cellpadding="1" cellspacing="2">
<tr>
<td width="86">Title :</td>
<td><input name="title" type="text" id="title" size="57" value=<?=$title?> /></td>
</tr>
<tr>
<td valign="top">Roman :</td>
<td><textarea name="roman" id="roman" cols="55" rows="5"></textarea></td>
</tr>
<tr>
<td valign="top">Hindi :</td>
<td><textarea name="hindi" id="hindi" cols="55" rows="5"></textarea></td>
</tr>
<tr>
<td>Poet :</td>
<td width="365"><input name="poet" type="text" id="poet" size="57" /></td>
</tr>
<tr>
<td>Category:</td>
<td><select name="category" id="category">
<option value="Ghazal or Nazm">Ghazal or Nazm</option>
<option value="Other">Other</option>
</select></td>
</tr>
<tr>
<td>
<div align="left">Code:</div></td>
<td><input name="code" type="text" id="code" size="4" maxlength="4" /><?=$msg?>
<iframe src="captcha.php" width="75" height="25" scrolling="No" frameborder="0"></iframe>
</td>
</tr>
<tr>
<td>
<div align="right"></div></td>
<td><input type="submit" name="submit" id="submit" value="Submit" /> <input type="submit" name="reset" id="reset" value="Clear" /></td>
</tr>
</table>
</form>
</body>
</html>