PDA

View Full Version : Post bài mới như post thread ?



Kaetta
11-05-2009, 15:59
*chỉ lên trên*
Tình hình là em đang mò cách làm sao để khi mình post bài mới lên web giống như tạo thread bình thường trong forum. Nghĩa là làm trực tiếp và nó tự động chuyển trực tiếp chứ không phải kiểu ghi ra rồi up source lên. ~_~ Tương tự như tạo biểu mẫu kiểu guestbook nhưng mỗi bài lại là một trang khác theo một cấu trúc đã được định sẵn. Tình hình là em đã tạo được cái trang để nhập dữ liệu rồi, chỉ còn về phần cách tạo trang mới để dữ liệu hiển thị lên đó theo một cấu trúc đã được định sẵn. '_______' (mong là các anh chị hiểu em đang hỏi về cái chi :"> => khi post bài lên hỏi người khác chỉ sợ vụ này nhất :D)

Tiện thể, ở đây em muốn tạo trang web theo link sample.php?sample=sample. 8-|

snoob
11-05-2009, 16:39
Tình hình là em đang mò cách làm sao để khi mình post bài mới lên web giống như tạo thread bình thường trong forum. Nghĩa là làm trực tiếp và nó tự động chuyển trực tiếp chứ không phải kiểu ghi ra rồi up source lên. ~_~ Tương tự như tạo biểu mẫu kiểu guestbook nhưng mỗi bài lại là một trang khác theo một cấu trúc đã được định sẵn. Tình hình là em đã tạo được cái trang để nhập dữ liệu rồi, chỉ còn về phần cách tạo trang mới để dữ liệu hiển thị lên đó theo một cấu trúc đã được định sẵn. '_______' (mong là các anh chị hiểu em đang hỏi về cái chi :"> => khi post bài lên hỏi người khác chỉ sợ vụ này nhất )
MYSQL
sample.php?sample=sample đây là link dạng get khi ngươì dùng nhập vào link dạng này thể check bằng cách:


if($_GET['spam'] == 'spam') echo 'Hello Spammer';
else echo 'Bye World';

Còn tạo trang web có link vâỵ thì:
<a href="sample.php?spam=spam">Click here to spam</a?

Kaetta
11-05-2009, 16:53
@ snoob : Cái vụ MySQL thì em biết. ;____; Chỉ có điều là không biết ứng dụng sao thôi :


<html>
<head>
<title>MY WORLD</title>
</head>
<body>
<form action="" method="POST" enctype="multipart/form-data">
<b>ID</b> : <input type="text" name="id" size="30"><p>
<b>Pass</b> : <input type="password" name="pass" size="30"><p>
<input type="submit" name="login" value="Login"><p>
<?php
if ($login == "Login")
{
if ($id == "id" and $pass == "pass") {
echo "
<b>Mục</b> : <select name='muc'>
<option value=''>Chọn một mục</option>
<option value='longfiction'>Long Fiction</option>
<option value='shortfiction'>Short Fiction</option>
<option value='fanfiction'>Fanfiction</option>
<option value='tuybut'>Tuỳ Bút</option>
<option value='tho'>Thơ</option>
</select><p>
<b>Tên file fic</b> : <input type='text' name='tenfilefic' size='30'><p>
<b>Tên file chương</b> : <input type='text' name='tenfilechuong' size='30'><p>
<b>Tên fic</b> : <input type='text' name='tenfic' size='30'><p>
<b>Phân đoạn</b> : <input type='text' name='loai' size='30'> : <input type='text' name='chuong' size='30'><p>
<b>Category</b> :<p>
<textarea name='category' cols='55' rows='10' wrap=virtual style='font-family:verdana;font-size:small;'></textarea><p>
<b>Nội dung</b> :<p>
<textarea name='noidung' cols='125' rows='100' wrap=virtual style='font-family:verdana;font-size:small;'></textarea><p>
<input type='submit' name='guidi' value='Gửi đi'> <input type='reset' name='vietlai' value='Viết lại'><p><p>
";
}
else
{
echo "<font color=red>Bạn không có quyền truy cập trang này</font>";
}
}
if ($guidi == "Gửi đi")
{
include("db_connect.php");
$query = "Insert into postfic (muc, tenfic, chuong, category, noidung, tenfilefic, tenfilechuong, loai) values ('$muc','$tenfic','$chuong','$category','$noidung' ,'$tenfilefic','$tenfilechuong'.'$loai')";
mysql_query($query) or
die (mysql_error());
echo "<font color=red><center>Bài của bạn đã được gửi đi.</center></font>";
}
?>

=> Phần lấy dữ liệu => Đã làm được. Nhưng phần hiển thị dữ liệu lại gặp rắc rối.



<div class="tab-content-largest"><?php
include("db_connect.php");
$result = mysql_query("select * from postfic") or
die (mysql_error());
while ($row = @mysql_fetch_array($result))
{
echo $row["tenfic"];
echo " - ";
echo $row["loai"];
echo $row["chuong"];
} ?></div>
<div class="content-largest">
<?php
if($page=="") {
$page="1";
}
else {
$page=$_REQUEST['page'];
}
$sql = "select * from postfic";
$limit = "1";
$result = mysql_query("select * from postfic") or
die (mysql_error());
$number = mysql_num_rows($result);
$list=ceil($number/$limit);
$start=(($page*$limit)-$limit);
$result = mysql_query("SELECT * FROM postfic ORDER BY tenfilefic DESC LIMIT $start,$limit")
or die (mysql_error());
while ($row = @mysql_fetch_array($result))
{
echo "<fieldset><legend>Category</legend>";
echo $row["category"];
echo "</fieldset><p>";
echo "============================<p>";
echo $row["noidung"];
}
?>
</div><p>
<div class="module-right">
<div class="tab-content">Phân đoạn</div>
<div class="content">
<?php
$row = @mysql_fetch_array($result);
for($i=1; $i<=$list; $i++) {
if ($i==$page) {
echo $row["loai"];
echo " : ";
echo "[<font color=red><b>".$row["chuong"]."</b></font>]<br>\n";
}
else {
echo $row["loai"];
echo " : ";
echo "&nbsp;<A HREF=\"tukhuc.php?phandoan=$i\">".$row["chuong"]."</A>&nbsp;<br>\n";
}
}
?>
</div>
</div>


=> Phần code này là do em mổ xẻ từ code phân trang ạ. ~__~ (dân gà nó thế =_=)

chienbinhdaxanh
22-06-2009, 18:29
bhjnkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

[=========> Bổ sung bài viết <=========]

hj, minh da install delta force 3 nhung ko choi single dc?????????????????ai da va dang play cho nay rui lam on chi giup minh...thanks nhieu