最近才学PHP,许多东西不会,在网上下了一个CI框架,试着搞一个简单的留言板,发现在许多问题搞不定,发贴请教高人,望给予支持赐教呀。views文件夹下面有一个文件名叫guestbook.tpl内容如下:
<table width="600" align="center" class="MainFont">
    <tr>
        <td height="20"></td>
    </tr>
    <tr>
        <td align="center" class="TableBorder">留言板</td>
    </tr>
    <tr>
        <td align="right" class="LeftBorder RightBorder">[<a href="GuestForm.html" class="MainFont">我要留言</a>]&nbsp;</td>
    </tr>
    <tr>
        <td align="center" class="TableBorder">
            <table align="left" width="600">
                <tr>
                    <td align="center" width="100" valign="middle" class="MainFont RightBorder">游客留言</td>
                    <td align="left" width="500" valign="Top" class="MainFont">留言内容:<br><hr style="height:1px;color:#cccccc;">管理员回复:</td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td align="center" class="LRBBorder">&nbsp;</td>
    </tr>
    <tr>
        <td align="center" class="LRBBorder">
        <table width="600" align="center">
            <form name="GuestForm" action="guestbook/save" method="post">
            <tr>
                <td align="left" valign="top">访客称谓:</td>
                <td align="left" valign="top"><input type="text" name="User_Name" style="width:200px;"></td>
            </tr>
            <tr>
              <td align="left" valign="top">留言内容:</td>
              <td align="left" valign="top"><label>
                <textarea name="User_Content" style="width:400px;height:150px;"></textarea>
              </label></td>
            </tr>
            <tr><td colspan="2" align="center" valign="middle"><label>
                  <input type="submit" name="Submit" value="提交" />
                </label>      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <label>
                <input type="Reset" name="Submit2" value="重置" />
                  </label></td>
              </tr>
            </form>
        </table>
        
        </td>
    </tr>
   
</table>controllers文件夹下面有一个文件名叫guestbook.php内容如下:
<?php
if (!defined('BASEPATH'))
    exit ('No direct script access allowed');class Guestbook extends Controller
{
    function Guestbook() { 
        parent::Controller();
    }
    
    function index() {
        $this->load->view('guestbook.tpl'); 
        //echo "Hello World!";
    } 
}
?>models文件夹下面有一个文件名叫GuestbookSave.php内容如下:
<?php
  class Guestbook_Save extends Model
{
    function Guestbook_Save() {
        parent::Model();
    }
    function save($params){
        extract($params);
        $username=trim($_POST['User_Name']);
        $content=trim($_POST['User_Content']);
            
        $this->load->database();
        $sql=array(
            'MessagesName'=>$content,
            'Content'=>$username;
            'MDateTime'=>date("Y-m-d H:i:s");
            'MIP' =>getenv('REMOTE_ADDR')); 
        $this->db->insert('messages',$sql);       
    }
}
?>三个文件的代码已全部贴上,现在我讲下问题:
我在地址栏输入http://127.0.0.1/guestbook
打开页面后提交内容,报错了,错误提示如下:
404 Page Not Found
The page you requested was not found.

解决方案 »

  1.   

    http://127.0.0.1/guestbook.php
    后缀不能省
      

  2.   

    我在地址栏输入http://127.0.0.1/guestbook 
    打开页面后提交内容,报错了,错误提示如下: 
    404 Page Not Found 
    The page you requested was not found.http://127.0.0.1/guestbook.php
    狂汗,雷雨汗,海嘯汗 
      

  3.   

    这个不要紧的,我用http://127.0.0.1/guestbook这个就能打开的呀,能显示表单那个页面(guestbook.tpl)是正常打开的,但是提交内容就不行了,报404 Page Not Found 
    The page you requested was not found.这个错误
      

  4.   

    我看了教程搞的,CI框架可以这么写的呀
    我估计是guestbook.tpl这个文件里面form的Action部分写的不对,还有可能是GuestbookSave.php文件也有问题
      

  5.   

    请大家帮个忙呀,自己初学PHP,身边又没有人会这个
      

  6.   

    <form name="GuestForm" action="guestbook/save" method="post"> 
    仔细看一下...你有这个文件么?