T4VN is an online PHP Help community that provides PHP Tutorials, PHP Examples, PHP Scripts, PHP Support
    HOME  |  HOSTING COUPON  |  TEMPLATE  |  PHP SCRIPTS  |  LINK TO US  |  LINK  |  REGISTER | CONTACT
::: Member Login :::
 Username
 Password
 
Forgot your password ?
::: PHP Tutotal :::
  PHP Basic (7)
  PHP Advanced (4)
  PHP Database (2)
  Coding Step By Step (8)
  PHP and AJAX (0)
::: PHP Example :::
  Arrays (1)
  Code Highlighters (3)
  Database Functions (12)
  Date & Time (5)
  E-Mail (6)
  Forms (5)
  Guestbooks (1)
  Logging (2)
  Miscellaneous (10)
  Password Generators (3)
  Randomizers (3)
  String Manipulation (10)
  User Authentication (6)
::: Search On T4VN :::
::: T4VN Statistics :::
  PHP Scripts : 61
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 93
  Total Coupon : 36
  Other Tutorials :
  Member : 200
  Visitor Online : 2
  Today Visit: 216
  Total Visitor : 229493
  Most Online : 31
::: Sponsored Links :::

PR 4 For This Webpage
Home Today :

Create Simple ShoutBox


Create Simple ShoutBox

Step 1 : Create database with information :

PHP Tutorials :

CREATE TABLE `tagboard` ( 
`id` int(7) NOT NULL auto_increment, 
`name` varchar(250) NOT NULL default '', 
`comments` text NOT NULL, 
`date` timestamp(14) NOT NULL, 
PRIMARY KEY (`id`), 
) TYPE=MyISAM AUTO_INCREMENT=419 ;


Step 2 : Create file config.php with content

PHP Tutorials :

<? 
$dbuser
=""//Database Username 
$dbname=""//Database Name 
$dbpass=""// Database Password 
?> 


Step 3: Create File tag.php with content :

PHP Tutorials :

<iframe src="view.php" name="tag" width="179" height="130" frameborder=0 marginwidth="0" marginheight="0"></iframe><form method="POST" ACTION="todo.php"> 
<input type="text" NAME="name" Value=">"> 
<textarea NAME="post" cols="27" rows="3"></textarea> 
<br> 
<input TYPE="submit" value="Submit">


Step 4: Create file todo.php with content :

PHP Tutorials :

<?php 
if ($name == '' || $post == ''") 

die ("
Please fill all fieldsClick <a HREF=tag.php>here</ato return."); 

include('config.php'); 

$post = preg_replace("
/</","&lt;",$post); 
$post = preg_replace("
/>/","&gt;",$post); 
$post = nl2br($post); 
$comments = "
$post"; 


$c=mysql_connect("
localhost","$dbuser","$dbpass"); 
mysql_select_db($dbname); 
$todo="
INSERT INTO tagboard (id,name,comments,dateVALUES('','$name','$comments',now())"; 
$solution = mysql_query($todo) or die (mysql_error()); 
if ($solution) 

?> 
<meta http-equiv="
refresh" content="0;url=tag.php" > 
<? 
} ?>



Step 5 : Finally,create file view.php with content :

PHP Tutorials :

<?php 
include('config.php'); 
//K&#7871;t n&#7889;i DB 
$c=mysql_connect("localhost","$dbuser","$dbpass"); 
//L&#7921;a ch&#7885;n DB 
mysql_select_db($dbname); 
//L&#7921;a ch&#7885;n tên DB 
$todo='SELECT * FROM `tagboard` order by id desc LIMIT 50'
$solution=mysql_query($todo); 
while (
$place mysql_fetch_array($solution)) 

$id=$place["id"]; 
$comments=$place["comments"]; 
//là nơi hi&#7875;n th&#7883; trên trang web 
?> 
»<b><? echo "$place[name]"?></b><? echo ": $comments<br>" ?> 
<? 
}?> 



You're done.Good luck

Author By T4VN Team

Other Tutorials
Sending Simple Text Emails
Simple Hit Counter
Building a Counter

::: Resources :::
  Links Directory
  Programming 2 3
  Webmaster 2 3
  Web Design 2 3
  Web Hosting 2 3
  Other Links 2 3
  Asian ShowBiz News
  Teach Seo For You
::: New Templates :::




::: Other Tutorials :::
 Program Design

  Powered By T4VN.NET - Version 2.0 - CopyRight © T4VN.NET 2005-2007