How can i Insert data from a PHP Form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shaharia
Forum Newbie
Posts: 2
Joined: Wed Dec 24, 2008 1:43 am

How can i Insert data from a PHP Form

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How can i Insert data from a PHP Form

Post 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.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: How can i Insert data from a PHP Form

Post 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.
Post Reply