<?php if(isset($_POST["submit"])){ $title=$_POST["newsHead"]; $detail=$_POST["newsDetail"]; include("config.php"); $db->query("insert into news(newsHead,newsDetail) values('$title','$detail')"); } ?> <div style="width:100%; float:left; text-align:center; font-size:35px; font-weight:bold; color:#fff; background:#096; line-height:40px; margin:30px 0;">Insert Your New News</div> <div style="margin:0 30px; float:left;"> <form action="#" method="post"> <span style="width:100%; margin-bottom:10px; float:left; font-size:20px; line-height:20px;">News Title :</span><br /> <input type="text" name="newsHead" placeholder="News Title" size="40" maxlength="30" style="width:100%; margin-bottom:10px; float:left; font-size:20px; line-height:20px;" required="required" /><br /> <span style="width:100%; margin-bottom:10px; float:left; font-size:20px; line-height:20px;">News Detail :</span><br /> <textarea name="newsDetail" rows="10" cols="110" placeholder="News Detail" style="width:100%; margin-bottom:10px; float:left; clear:left;" required="required"></textarea><br /> <input type="submit" name="submit" value="Save New News" style="width:30%; height:30px; margin:20px 0 0 35%; float:left;" /> </form><br /> </div> create table news( id int(10) primary key auto_increment, newsHead varchar(50), newsDetail text );
May be unsupported characters is encountered when you submitted form. You should use htmlspecialchars() php function before submit $_POST data. see the php manual http://php.net/htmlspecialchars
data base (table field) datatype text dite hobe . tateo jodi copy kora text insert na hoi tahole text box er data recieve korar somoy mysql_escape_string() use korle solution hobe. ex: $data=mysql_escape_string($_POST["txtData"];);
mysql_escape_string() function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged. http://bd1.php.net/mysql_escape_string
Comments 11