class T {
var $id; //图书ID
var $name; //图书名称
var $store; //图书库存量
var $lend; //图书上架量
var $publishing; //图书出版社
var $next=NULL;
/* function T($i,$n,$s,$l,$p) { //构造函数
$this->id = $i;
$this->name=$n;
$this->store=$s;
$this->lend=$l;
$this->publishing=$p;
}*/
}echo "<style type=\"text/css\">";
echo "<!--";
echo ".bt{background-color:#ebf4fd;text-align:center;}";
echo "//-->";
echo "</style>";echo "<html><head><title>链表结构的简单应用(PHP)</title>";
echo "<META http-equiv=Content-Type content=\"text/html; charset=gb2312\">";
echo "<LINK href=\"css/admin.css\" type=\"text/css\" rel=\"stylesheet\"></head>";
echo "<body>";
echo "<table border=0><form action=\"create.php\" method=\"post\">";
echo " <tr><td>图书ID:</td><td><input type=\"text\" name=\"q_id\"></td></tr>";
echo " <tr><td>图书名称:</td><td><input type=\"text\" name=\"q_name\" /></td></tr>";
echo " <tr><td>图书库存量:</td><td><input type=\"text\" name=\"q_store\" /></td></tr>";
echo " <tr><td>图书上架量:</td><td><input type=\"text\" name=\"q_lend\" /></td></tr>";
echo " <tr><td>图书出版社:</td><td><input type=\"text\" name=\"q_publishing\" /></td></tr>";
echo " <tr><td><input type=\"submit\" value=\"确定\"/></td><td><input type=\"reset\" /></td></tr>";
echo "</form></table>";
echo "<TABLE cellSpacing=0 cellPadding=0 width=\"95%\" align=center border=0>";
echo " <TR height=20><TD></TD></TR>";
echo " <TR height=22><TD style=\"PADDING-LEFT: 20px; FONT-WEIGHT: bold; COLOR: #ffffff\" align=middle background=images/title_bg2.jpg>链表内容如下</TD></TR>";
echo " <TR bgColor=#ecf4fc height=12><TD></TD></TR>";
echo " </TABLE>";
echo "<table cellSpacing=0 cellPadding=0 width=\"95%\" align=center border=0>";
echo " <tr height=10><td class=\"bt\">图书ID</td><td class=\"bt\">图书名称</td><td class=\"bt\">图书库存量</td><td class=\"bt\">图书上架量</td><td class=\"bt\">图书出版社</td></tr>";
echo "</table>";
echo "</body>";
echo "</html>";$m = new T();
$head = new T();
$m=$head;
if (isset($_POST["q_id"])){
if($m->next==NULL){
$m->id=$_POST["q_id"];
$m->name=$_POST["q_name"];
$m->store=$_POST["q_store"];
$m->lend=$_POST["q_lend"];
$m->publishing=$_POST["q_publishing"];
}
else{
//这段根本就执行不了,愁死了~~!!!
while($m2->next!=NULL){
$m2=$m->next;
}
$m->next = new T();
$m->next->id=$_POST["q_id"];
$m->next->name=$_POST["q_name"];
$m->next->store=$_POST["q_store"];
$m->next->lend=$_POST["q_lend"];
$m->next->publishing=$_POST["q_publishing"];
$m->next->next=NULL;
$m2=$m3;
$m->next=$m3;
$m=$head;
}
print_r($m);
}
else
echo"链表内没有内容!";
?>
var $id; //图书ID
var $name; //图书名称
var $store; //图书库存量
var $lend; //图书上架量
var $publishing; //图书出版社
var $next=NULL;
/* function T($i,$n,$s,$l,$p) { //构造函数
$this->id = $i;
$this->name=$n;
$this->store=$s;
$this->lend=$l;
$this->publishing=$p;
}*/
}echo "<style type=\"text/css\">";
echo "<!--";
echo ".bt{background-color:#ebf4fd;text-align:center;}";
echo "//-->";
echo "</style>";echo "<html><head><title>链表结构的简单应用(PHP)</title>";
echo "<META http-equiv=Content-Type content=\"text/html; charset=gb2312\">";
echo "<LINK href=\"css/admin.css\" type=\"text/css\" rel=\"stylesheet\"></head>";
echo "<body>";
echo "<table border=0><form action=\"create.php\" method=\"post\">";
echo " <tr><td>图书ID:</td><td><input type=\"text\" name=\"q_id\"></td></tr>";
echo " <tr><td>图书名称:</td><td><input type=\"text\" name=\"q_name\" /></td></tr>";
echo " <tr><td>图书库存量:</td><td><input type=\"text\" name=\"q_store\" /></td></tr>";
echo " <tr><td>图书上架量:</td><td><input type=\"text\" name=\"q_lend\" /></td></tr>";
echo " <tr><td>图书出版社:</td><td><input type=\"text\" name=\"q_publishing\" /></td></tr>";
echo " <tr><td><input type=\"submit\" value=\"确定\"/></td><td><input type=\"reset\" /></td></tr>";
echo "</form></table>";
echo "<TABLE cellSpacing=0 cellPadding=0 width=\"95%\" align=center border=0>";
echo " <TR height=20><TD></TD></TR>";
echo " <TR height=22><TD style=\"PADDING-LEFT: 20px; FONT-WEIGHT: bold; COLOR: #ffffff\" align=middle background=images/title_bg2.jpg>链表内容如下</TD></TR>";
echo " <TR bgColor=#ecf4fc height=12><TD></TD></TR>";
echo " </TABLE>";
echo "<table cellSpacing=0 cellPadding=0 width=\"95%\" align=center border=0>";
echo " <tr height=10><td class=\"bt\">图书ID</td><td class=\"bt\">图书名称</td><td class=\"bt\">图书库存量</td><td class=\"bt\">图书上架量</td><td class=\"bt\">图书出版社</td></tr>";
echo "</table>";
echo "</body>";
echo "</html>";$m = new T();
$head = new T();
$m=$head;
if (isset($_POST["q_id"])){
if($m->next==NULL){
$m->id=$_POST["q_id"];
$m->name=$_POST["q_name"];
$m->store=$_POST["q_store"];
$m->lend=$_POST["q_lend"];
$m->publishing=$_POST["q_publishing"];
}
else{
//这段根本就执行不了,愁死了~~!!!
while($m2->next!=NULL){
$m2=$m->next;
}
$m->next = new T();
$m->next->id=$_POST["q_id"];
$m->next->name=$_POST["q_name"];
$m->next->store=$_POST["q_store"];
$m->next->lend=$_POST["q_lend"];
$m->next->publishing=$_POST["q_publishing"];
$m->next->next=NULL;
$m2=$m3;
$m->next=$m3;
$m=$head;
}
print_r($m);
}
else
echo"链表内没有内容!";
?>
$head = new T();
$m=$head; //为什么要重新对 $m 赋值while($m2->next!=NULL){ // $m2 从哪里来的
$m2=$m->next;
}
$m->next = new T();$m2=$m3; // $m3 从哪里来的
$m->next=$m3;
/************************************************************************
* 吉林省高等教育自学考试论文答辩程序 *
* *
* 论文题目:链表结构的简单应用 *
* 专 业:计算机应用 *
* 准考证号:072410100217 *
* 学生姓名:王冰岩 *
* 指导教师: *
* 制作日期:2011年06月03日 *
************************************************************************/
class T {
var $id; //图书ID
var $name; //图书名称
var $store; //图书库存量
var $lend; //图书上架量
var $publishing; //图书出版社
var $next=NULL;
/* function T($i,$n,$s,$l,$p) { //构造函数
$this->id = $i;
$this->name=$n;
$this->store=$s;
$this->lend=$l;
$this->publishing=$p;
}*/
}//$p = new T(1);
//$p->next = new T(2);
echo "<style type=\"text/css\">";
echo "<!--";
echo ".bt{background-color:#ebf4fd;text-align:center;}";
echo "//-->";
echo "</style>";echo "<html><head><title>链表结构的简单应用(PHP)</title>";
echo "<META http-equiv=Content-Type content=\"text/html; charset=gb2312\">";
echo "<LINK href=\"css/admin.css\" type=\"text/css\" rel=\"stylesheet\"></head>";
echo "<body>";
echo "<table border=0><form action=\"create.php\" method=\"post\">";
echo " <tr><td>图书ID:</td><td><input type=\"text\" name=\"q_id\"></td></tr>";
echo " <tr><td>图书名称:</td><td><input type=\"text\" name=\"q_name\" /></td></tr>";
echo " <tr><td>图书库存量:</td><td><input type=\"text\" name=\"q_store\" /></td></tr>";
echo " <tr><td>图书上架量:</td><td><input type=\"text\" name=\"q_lend\" /></td></tr>";
echo " <tr><td>图书出版社:</td><td><input type=\"text\" name=\"q_publishing\" /></td></tr>";
echo " <tr><td><input type=\"submit\" value=\"确定\"/></td><td><input type=\"reset\" /></td></tr>";
echo "</form></table>";
echo "<TABLE cellSpacing=0 cellPadding=0 width=\"95%\" align=center border=0>";
echo " <TR height=20><TD></TD></TR>";
echo " <TR height=22><TD style=\"PADDING-LEFT: 20px; FONT-WEIGHT: bold; COLOR: #ffffff\" align=middle background=images/title_bg2.jpg>链表内容如下</TD></TR>";
echo " <TR bgColor=#ecf4fc height=12><TD></TD></TR>";
echo " </TABLE>";
echo "<table cellSpacing=0 cellPadding=0 width=\"95%\" align=center border=0>";
echo " <tr height=10><td class=\"bt\">图书ID</td><td class=\"bt\">图书名称</td><td class=\"bt\">图书库存量</td><td class=\"bt\">图书上架量</td><td class=\"bt\">图书出版社</td></tr>";
echo "</table>";
echo "</body>";
echo "</html>";
$m = new T();
$head = new T();
if (isset($_POST["q_id"])){
if($m->next==NULL){
$m->id=$_POST["q_id"];
$m->name=$_POST["q_name"];
$m->store=$_POST["q_store"];
$m->lend=$_POST["q_lend"];
$m->publishing=$_POST["q_publishing"];
$head=$m; //保存头结点
}
else{
while($m->next!=NULL){
$m=$m->next;
}
$m->next = new T();
$m=$m->next;
$m->id=$_POST["q_id"];
$m->name=$_POST["q_name"];
$m->store=$_POST["q_store"];
$m->lend=$_POST["q_lend"];
$m->publishing=$_POST["q_publishing"];
$m=$head;
}
print_r($m);
}
else
echo"链表内没有内容!";
?>