How can i Insert data from a PHP Form
Posted: Wed Dec 24, 2008 2:07 am
I have a form with value (newstitle & newstext). And i have created a MySQL Table "persons") with the field ('newsid, 'title', 'news', 'time').
When i click on my submit button of News writing form then how can i insert data from newstitle & newstext to mySQL database.
Here is my MySQL Table Structure

& Here is my News writing form

I have already used this code but it doesn't seem to work::::
<?php
$conn=mysql_connect('localhost','root','123');
mysql_select_db('news', $conn);
$newstitle = $_REQUEST['newstitle'];
$newstext= $_REQUEST['newstext'];
mysql_query = INSERT INTO `persons` VALUES ( NULL , 'newstitle', 'newstext', NULL );
?>::::
So please solve this problem & mail me full PHP code about how can i insert data into MySQL table from a PHP form.... My e-mail: gmrume@gmail.com
When i click on my submit button of News writing form then how can i insert data from newstitle & newstext to mySQL database.
Here is my MySQL Table Structure

& Here is my News writing form

I have already used this code but it doesn't seem to work::::
<?php
$conn=mysql_connect('localhost','root','123');
mysql_select_db('news', $conn);
$newstitle = $_REQUEST['newstitle'];
$newstext= $_REQUEST['newstext'];
mysql_query = INSERT INTO `persons` VALUES ( NULL , 'newstitle', 'newstext', NULL );
?>::::
So please solve this problem & mail me full PHP code about how can i insert data into MySQL table from a PHP form.... My e-mail: gmrume@gmail.com