Welcome to WebmasterWorld Guest from 220.127.116.11
Thanks for the great advice. I have another question. How would I turn the titles of my database news articles into links. I would like for the visitor to click the title, and be taken to the actual page the article is located? Can that be done?
Thanks in Advance,
// connect to the mysql server
mysql_connect("localhost","moot","ok") or die (mysql_error());
echo "Connected to Mysql<br/>";
// select the database
mysql_select_db("News_Articles") or die
echo "Connected to Database<br/>";
// insert data into ccds_news table
$sql = "INSERT INTO ccds_news(article_title, author_name, subject, date_created, content, EMAIL) VALUES('" . $_POST['article_title'] . "', '" . $_POST['author_name'] . "', '" . $_POST['subject'] . "', '" . $_POST['date_created'] . "', '" . $_POST['content'] . "', '" . $_POST['EMAIL'] . "' )";
// run the query
echo "DATA ENTERED!";
The php.net tutorial has a page on forms at [be2.php.net...] and you might want to get a book on paper too.
When any link is clicked, you simply pull data based on the value of 'id' in the query string.
$query = "SELECT FROM table WHERE id = '" . $_GET['id'] . "' LIMIT 1";
//rest of code
I would suggest you follow the link that mincklerstraat has posted, it should point you in the right direction.
are you talking about links like this:
for a story with the title: "freddie star ate my hamster"?
you need to google for 'search engine friendly URLs'. this article by sitepoint is a great starter: [sitepoint.com...] (although it might not work unless you have register_globals on in your php setting.) have a read and come back with questions.