SQL PHP HTML ASP JavaScript articles and free scripts to download If you are facing any problem in viewing this page, please tell us
 
 

PHP RSS feed generator form to entering data to a table

If you are a web publisher or maintain web sites then it is a good idea to give RSS feed to your visitors or other web masters to publish your contents in their websites or in other Medias. RSS is quite popular in the field of content syndicating and going to play a major role in days to come. By using RSS feed in your web site you can tell about your site updates and new articles / pages to the world with out much effort. You can know more about RSS feed and its uses in our article section. Here we will discuss on creating a RSS feed by using PHP script. We will not discuss about reading RSS feeds and you will get lot of free script, programs to download and use to display RSS feeds. Here we will focus on developing XML format for RSS feed. There are many ways to do this and here we will discuss one of the way which this site uses.

There are two steps involved in developing a RSS feed. First we will update a table with new updates and second step is updating the RSS page from the table. You can bypass the table and directly update the RSS page but by using a table we can keep a history of previous updates and its date of publications.

The first step is creating a form and then storing the entered data to a table. Here the form is designed to take data as per the required format of RSS feed. We need four inputs, one is title (this will be used as anchored text so important for our keyword ranking), Link (the URL of the page), description and publication date. The publication date has to be in a particular format known as RFC-822 date format. The format looks like this

Sat, 11 Oct 2004 09:00:00 EST
Mon, 05 Sep 2002 14:00:00 GMT
Wed, 14 Oct 2003 17:00:00 +0200

So we will pre populate the date field with present time in this format, but we will have option of changing it. Here is the sample form.


echo "<hr>";
$tm=time();  // time stamp of the present time
$tm=date("D, d M Y H:i:s",$tm); // generating the format
$tm=$tm. " GMT"; // added GMT but you can add your format
echo "<form method=post action=rsspostck.php>
Title<input type=text name=title size=100><br>
Link<input type=text name=page_link size=100><br>
Description<textarea name=description cols=60 rows=5></textarea><br>
Publication Date<input type=text name=pubdate size=35 value='$tm'>Wed, 21 Apr 2005 08:20:47 GMT<br>
<input type=submit value='Add'></form>
";


Using this form we can insert the data to MySQL table. You can add all the form validations etc by referring to the page on php form validation. With this sql insert command the new record will be added to the table.

$rt=mysql_query("insert into rss(title,link,description,pubdate) values('$title','$page_link','$description','$pubdate')");

With this we will able to add new updates to a table in a format and using this we will update our rss feed page in the second part of the tutorial.

You can download the code for this tutorial here.

 

Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
PHP Tutorials
PHP Monthly Planner
PHP Introduction
Loops & structure
Array
Date & Time
Functions
Form Handling
File Handling
Math Functions
String Functions
GD Functions
Comment Posting
Content Management
PHP & Ajax
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.