<?php
require "db.inc";
require_once "HTML/Template/ITX.php";// Test for user input
if (!empty($_GET["surname"]) &&
    !empty($_GET["firstname"]) &&
    !empty($_GET["phone"]))
{
  if (!($connection = @ mysql_connect("localhost", "root", "pengshifu")))
     die("Could not connect to database");  $surname = mysqlclean($_GET, "surname", 50, $connection);
  $firstname = mysqlclean($_GET, "firstname", 50, $connection);
  $phone = mysqlclean($_GET, "phone", 20, $connection);  if (!mysql_select_db("telephone", $connection))
     showerror();  // Insert the new phonebook entry
  $query = "INSERT INTO phonebook VALUES
            (NULL, '{$surname}', '{$firstname}', '{$phone}')";  if (!(@mysql_query ($query, $connection)))
    showerror();  $template = new HTML_Template_ITX("./templates");
  $template->loadTemplatefile("exa.tpl", true, true);
  $template->setCurrentBlock();
  $template->setVariable("SURNAME", $surname);
  $template->setVariable("FIRSTNAME", $firstname);
  $template->setVariable("PHONE", $phone);
  $template->parseCurrentBlock();  $template->show();
} // if empty()
else
  // Missing data: Go back to the <form>
  header("Location: example.8-1.html");
?>我怎么找不到包含文件require_once "HTML/Template/ITX.php";
这个呢。?还有。添加信息和这个啥模板的有什么关系啊?

解决方案 »

  1.   

    肯定是路径了。
    你用绝对+相对路径吧。require(dirname(__FILE__).'/相对路径');
      

  2.   

    require_once "HTML/Template/ITX.php";
    表示和当前文件同一目录下的HTML/Template/ITX.php,你确定这个文件路径是对的?
      

  3.   


    添加信息是php语言,模板是为这个语言提供数据输出的
      

  4.   

    你删除的是Template里的对应的模板么???
      

  5.   


    就和html差不多,要来显示数据和提交数据操作的