Dodawanie forum zrobiłem w dwóch plikach. Pierwszy to strona z wyświetleniem forum, a drugi funkcja który dodaje je. Wiem nazwy są głupie ale później wszystko poprawiam. Oto pliki:
forumadd.php
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <title>Nazwa forum</title> <link REL="SHORTCUT ICON" HREF="images/favicon.ico"> <head> <link rel="stylesheet" href="default.css" type="text/css" media="screen"> <?php $host="-------"; // Host name $username="--------"; // Mysql username $password="--------"; // Mysql password $db_name="----------"; // Database name $tbl_name="---------"; // Table name // Connect to server and select databse. $sql="SELECT * FROM $tbl_name ORDER BY id ASC"; // OREDER BY id DESC is order result by descending // OREDER BY id ASC is order result by ascending ?> <div id="header"> <p><img src="images/header.jpg" width="800" height="200"></p> </div> <div id="bodymenu"> <div align="right" class="user"><p class=" "> <?php ?> </p> </div> <div id="menucontent"> </div> <div class="clear"> </div> </div> <?php //include 'login.php'; ?> <!-- <div id="menu"> </div> <!--<img src="images/counter.jpg">--> <?php //include 'counter.php'; ?> <td> </td> <div id="menu"> <?php include 'header.php'; ?> </div> <div id="body_forum"> <div class="bodymenu"><p class="data1">Forum</p></div> <div class="clear"> </div> <?php ?> <div class="clear"></div> <?php // Exit looping and close connection } ?> </div> <div class="clear"></div> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" class="style1"> <tr> <form id="form1" name="form1" method="post" action="add_forum.php" class="style1"> <td><br> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6B4248"> <tr> <td colspan="3" background="images/bottombar.jpg" style="height: 26px"><strong>Create New Forum</strong> </td> </tr> <tr> <td width="14%"><strong>Forum</strong></td> <td width="2%">:</td> <td width="84%"> <input name="forum" type="text" id="forum" size="50"></td> </tr> <tr> <td valign="top"><strong>Description</strong></td> <td valign="top">:</td> <td><textarea name="description" cols="50" rows="8" id="description"></textarea></td> </tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </table> </td> </form> </table> </div>
add_forum.php
<?php $host="-------"; // Host name $username="--------"; // Mysql username $password="--------"; // Mysql password $db_name="----------"; // Database name $tbl_name="---------"; // Table name // Connect to server and select database. // get data that sent from form $forum=$_POST['forum']; $description=$_POST['description']; $reply=$_POST['reply']; $posts=$_POST['posts']; $sql="INSERT INTO $tbl_name(forum, description, reply, posts, datetime)VALUES('$forum', '$description', '$reply', '$posts', '$datetime')"; if($result){ } else { } ?>
Chciałbym też dodać możliwość dodawania grup np forum admina, forum gości i forum np filmy, muzyka.
Teraz drugi problem. Naliczanie tematów i odpowiedzi. Myśle że błąd jest w kodzie gdzie wyświetlona ma być strona z tematami. Powinno być np nazwa.php?id=1 , a nie nazwa.php.
Oraz tekst na obrazku. Ponieważ te cyfry 99, 100 itd. są bardzo ważne to pomyślałem że tekst będzie na obrazku i ustawie czcionke na jak najmniejszą. Lub schować jakoś ten tekst ale to raczej nie możliwe.
Prosze o pomoc.
Wygląd forum będzie sie zmieniać, więc nie będzie taki jak na obrazku. Jedynie chodzi mi o jego funkcjonowanie. Nie podaje linku bo boje sie o spamowanie :/
Forumadd:
