Well, i'm in a hurry so i will make this short and quick. All you need to complete this tutorial is a bit HTML skills to understand the syntax. And a webhotel with PHP and a MySQL database.
It is allways god to start by making a database, so let's do that. Go to phpmyAdmin and put this code into:
CODE
CREATE TABLE `tagwall` (
`id` int(8) NOT NULL auto_increment,
`email` varchar(255) NOT NULL default '',
`name` varchar(255) NOT NULL default '',
`tag` text NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0;
`id` int(8) NOT NULL auto_increment,
`email` varchar(255) NOT NULL default '',
`name` varchar(255) NOT NULL default '',
`tag` text NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0;
Ok, now when we have made our table, then lets start with a form who writes our data into our database (
It is just simple HTML so i won't tell alot about it
So make a new file call it something like "write-tag.htm" and put this code into it:
CODE
<form method="post" action="put-tag.php">
E-Mail:
<input type="text" name="email">
Name:
<input type="text" name="name">
Tag:
<textarea name="tag" cols="50" rows="50"></textarea>
<input type="submit" name="Submit" value="Tag it!!!">
</form>
E-Mail:
<input type="text" name="email">
Name:
<input type="text" name="name">
Tag:
<textarea name="tag" cols="50" rows="50"></textarea>
<input type="submit" name="Submit" value="Tag it!!!">
</form>
Now are we ready to to put our data into our database, so make a new file and name it something like "put-tag.php".
Now listen...
What we are going to put all our data into our database. We will build a connection variable and use it to connect to our database. and second we will use the mysql_query command wich writes our data into our database. So put this code into your put-tag.php file:
CODE
<?php
$connection = mysql_connect("localhost","username","password");
mysql_select_db("database", $connection);
mysql_query("INSERT INTO tagwall (email, name, tag) VALUES ('$_POST[email]', '$_POST[name]', '$_POST[tag]')");
mysql_close;
echo "We got your tag!!";
?>
$connection = mysql_connect("localhost","username","password");
mysql_select_db("database", $connection);
mysql_query("INSERT INTO tagwall (email, name, tag) VALUES ('$_POST[email]', '$_POST[name]', '$_POST[tag]')");
mysql_close;
echo "We got your tag!!";
?>
Now we are allmost done, we just need to print all the data, so let's move on to the last file...
Make a new file and name it tagwall.php or something like that. And put this code into:
CODE
<?php
$connection = mysql_connect("localhost","username","password");
mysql_select_db("database", $connection);
$query = mysql_query("SELECT * FROM tagwall ORDER BY id DESC LIMIT 100") or die(mysql_error());
while ($row = mysql_fetch_assoc($query)) {
?>
<table>
<tr>
<td>From: <a href="mailto:<?=$row[email]?>"><?=$row[name]?></a></td>
</tr>
<tr>
<td><?=$row[tag]?></td>
</tr>
</table>
<?php
}
?>
$connection = mysql_connect("localhost","username","password");
mysql_select_db("database", $connection);
$query = mysql_query("SELECT * FROM tagwall ORDER BY id DESC LIMIT 100") or die(mysql_error());
while ($row = mysql_fetch_assoc($query)) {
?>
<table>
<tr>
<td>From: <a href="mailto:<?=$row[email]?>"><?=$row[name]?></a></td>
</tr>
<tr>
<td><?=$row[tag]?></td>
</tr>
</table>
<?php
}
?>
Well, i did not test this script so i don't know if it works, but try it and ask if you have any problems or just leave a comment if you like
Bye...