<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Tutorial Blog &#187; html</title>
	<atom:link href="http://www.thetutorialblog.com/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thetutorialblog.com</link>
	<description></description>
	<lastBuildDate>Tue, 08 Nov 2011 19:21:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<image>
<link>http://www.thetutorialblog.com</link>
<url>http://www.thetutorialblog.com/wp-content/plugins/maxblogpress-favicon/icons/favicon-28.ico</url>
<title>The Tutorial Blog</title>
</image>
		<item>
		<title>jQuery Form Validation</title>
		<link>http://www.thetutorialblog.com/video-tutorials/jquery-form-validation/</link>
		<comments>http://www.thetutorialblog.com/video-tutorials/jquery-form-validation/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 20:38:47 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[Video Tutorials]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=82</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Create a form that requires the user to enter both a username and password. If the username field or password field is left blank then a message will be displayed. No related posts. Related posts brought to you by Yet Another Related Posts Plugin.


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fvideo-tutorials%2Fjquery-form-validation%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fvideo-tutorials%2Fjquery-form-validation%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="jQuery Form Validation" alt=" jQuery Form Validation" /><br />
			</a>
		</div>
<p>Create a form that requires the user to enter both a username and password. If the username field or password field is left blank then a message will be displayed.</p>
<p><object type="application/x-shockwave-flash" width="512" height="399" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://blip.tv/scripts/flash/showplayer.swf" /><param name="flashvars" value="init=http://blip.tv/play/AYGN4GwA" /><embed src="http://blip.tv/play/AYGN4GwA" type="application/x-shockwave-flash" width="512" height="399" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/video-tutorials/jquery-form-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP News System Part 2</title>
		<link>http://www.thetutorialblog.com/php/php-news-system-part-2/</link>
		<comments>http://www.thetutorialblog.com/php/php-news-system-part-2/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 00:52:48 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Text Tutorials]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[news system]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=28</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	If you haven't already seen part 1 of this tutorial then watch it here. For the second part of this tutorial you will learn how to create a cookie to log the admin user in and create the tables for your news system. Ok so first of all we are going to modify the file [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fphp-news-system-part-2%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fphp-news-system-part-2%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="PHP News System Part 2" alt=" PHP News System Part 2" /><br />
			</a>
		</div>
<p>If you haven't already seen part 1 of this tutorial then watch it <a href="http://www.thetutorialblog.com/2008/06/17/php-news-system-part-1-with-sound/">here</a>.</p>
<p>For the second part of this tutorial you will learn how to create a cookie to log the admin user in and create the tables for your news system.</p>
<p><span id="more-28"></span></p>
<p>Ok so first of all we are going to modify the file from the first tutorial.</p>
<p>Modify:</p>
<blockquote><p>if($_POST['username == $username AND $_POST['password'] == $password)<br />
{<br />
echo '&lt;a href="newpost.php"&gt;New Post&lt;/a&gt;';<br />
}</p></blockquote>
<p>To</p>
<blockquote><p>if($_POST['username == $username AND $_POST['password'] == $password)<br />
{<br />
setcookie("username", $username, time()+3600);<br />
setcookie("password", $password, time()+3600);<br />
echo '&lt;a href="newpost.php"&gt;New Post&lt;/a&gt;';<br />
}</p></blockquote>
<p>The two new bits of code that we add are <em>setcookie("username", $username, time()+3600);</em> and <em>setcookie("password", $password, time()+3600);</em>. What we are doing here is creating a cookie called username and assigning the value of $username to it and <em>time()+3600</em> will make the cookie expire in 1 hour.</p>
<h3><strong>Create the news table</strong></h3>
<p>Insert the following MySQL code into phpMyAdmin or any kind of MySQL software that you are using</p>
<blockquote><p>CREATE TABLE  `news_system` (<br />
 `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,<br />
 `author` VARCHAR( 50 ) NOT NULL ,<br />
 `date` VARCHAR( 20 ) NOT NULL ,<br />
 `title` VARCHAR( 100 ) NOT NULL ,<br />
 `post` TEXT NOT NULL<br />
) ENGINE = MYISAM ;</p></blockquote>
<h3><strong>Connect To The Database</strong></h3>
<p>Create a file called dbconnect.php in the parent directory to the admin folder.</p>
<p>Enter the following code into dbconnect.php</p>
<blockquote><p>
&lt;?php<br />
$host = "localhost";<br />
$username = "username";<br />
$password = "password";<br />
$db = "news_system";</p>
<p>$conn = mysql_connect($host, $username, $password);<br />
mysql_select_db($db);<br />
?>
</p></blockquote>
<p>Change the variables $host, $username, $password and $db.<br />
Most of the time localhost is what the host will be so if you're unsure then don't change this.</p>
<h3><strong>Create News Submission Form</strong></h3>
<p>Create a file called newpost.php and insert the following code below into the newpost.php file.</p>
<h3><strong>Make the form</strong></h3>
<p>Now that are tables have been created in our database the next thing to do is to add a HTML form and PHP code to process the form.</p>
<p>Our HTML Form:</p>
<blockquote><p>&lt;form method="POST"&gt;<br />
Author: &lt;input type="text" name="author"&gt;&lt;br&gt;<br />
Title: &lt;input type="text" name="title"&gt;&lt;br&gt;<br />
Post:&lt;br&gt;<br />
&lt;textarea name="post" cols="30" rows="7"&gt; &lt;/textarea&gt;&lt;br&gt;<br />
&lt;input type="submit" name="submit" value="Publish Post"&gt;<br />
&lt;/form&gt;</p></blockquote>
<p>PHP Code:</p>
<blockquote><p>&lt;?php<br />
require("../dbconnect.php");<br />
//if submit button has been pressed<br />
if($_POST['submit']){<br />
//retrieve form text fields<br />
$author = $_POST['author'];<br />
$title = $_POST['title'];<br />
$post = $_POST['post'];</p>
<p>//get the date<br />
$date = date('d/m/Y');</p>
<p>//post information to database<br />
$query = mysql_query("INSERT INTO news_system VALUES('','$author','$date','$title','$post')");</p>
<p>if($query){<br />
echo "Post was successfully added to the database";<br />
}<br />
else {<br />
echo "Post was not added";<br />
}<br />
}</p>
<p>?&gt;</p></blockquote>
<p>
In the next post you will learn how to display the latest 5 posts.</p>
<p>If something isn't clear or you would like something to be included in the next post then please leave your comments.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/php/php-news-system-part-2/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

