Page 1 of 1

How can i Insert data from a PHP Form

Posted: Wed Dec 24, 2008 2:07 am
by shaharia
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

Image

& Here is my News writing form
Image

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

Re: How can i Insert data from a PHP Form

Posted: Wed Dec 24, 2008 2:53 am
by requinix
shaharia wrote:So please solve this problem & mail me full PHP code
:lol:

The problem with your code is that you don't know what you're doing. Learn some PHP - like this and this and this - try again, and come back if you have problems.

Re: How can i Insert data from a PHP Form

Posted: Wed Dec 24, 2008 6:30 pm
by califdon
In this forum, we do not solve people's problems by sending them "full PHP code". This is not a source for scripts. It is a forum where developers who already know how to use PHP ask specific questions about why a particular operation isn't working and we try to help each other by helping them find a specific fault. Sorry to disappoint you.