mdcloud
02-22-2008, 05:13 PM
hey everyone. i am trying to set up a news form for a client. i have used php before, but in a very limited way with help of others. this is the first time out on my own trying to use it. what i need is first how to send information from a html for over to a database. i have looked at a couple tutorials and dont seem to be getting it right. i have a database called newsbd and a table called news with three fields set up. my fields are ID which is set to autoincrement, title, and news. seems like i need coding like this on the php part but it didnt do anything
<?php
$title=$_POST['title'];
$news=$_POST['news'];
mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db("newsdb") or die(mysql_error());
mysql_query("INSERT INTO `news` VALUES ('$title', '$news')");
Print "Your information has been successfully added to the database.";
?>
can anyone please straighten me out. i would appreciate it.
<?php
$title=$_POST['title'];
$news=$_POST['news'];
mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db("newsdb") or die(mysql_error());
mysql_query("INSERT INTO `news` VALUES ('$title', '$news')");
Print "Your information has been successfully added to the database.";
?>
can anyone please straighten me out. i would appreciate it.