偶是新人 0.0 问个新人问题
article.php
   class Article{
      function  insert(){             //代码。
       }
      function   update(){
              //代码......
      } }
如果偶想调用 上面article.php文件的 insert方法  
    下面的form应该写 
     或者是另外的写法 不是用form
<form action="" method="post" > 

解决方案 »

  1.   

    头像比较有诱惑力想调用上面类的方法 跟form 有神马关系?首先
    include ('article.php'); //包含类文件
    实例化类
    $Mywork=new Article();//看你的结构需要传递什么参数.
    $Mywork->insert();//调用insert方法
      

  2.   

    你的类应该放在一个单独的php文件中。以xxx.class.php命名, 然后在article.php文件中包含此类,调用类中方法。 
      

  3.   

    估计是在学习吧,别给他们记那么多东西 一些规范以后慢慢传授,哈哈,呆会include 路径不对了又不知道哪出错了.
      

  4.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <link href="../../../css/css.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <form action="" method="post" >
    <?php
    include_once("article.class.php");
    $Article=new Article();
    echo $ret= $Article->update($_GET['id'],"修改后","内容1111111","","");
    $mysqli=new mysqli('127.0.0.1','root','','tk_db');
    $sql="select id,title,content,author,now from tk_article WHERE  id= ".$_GET['id'];
         $result = $mysqli->query($sql);
       while($row=$result->fetch_assoc()){
    echo <<<News
    <br/>
    <div align="center" style="font-size:32px"><strong>修改新闻</strong></div>
    <input type="hidden"   namw="id2" value="{$row['id']}"/>
    文章标题:<input type="text" name="title" value="{$row['title']}" style="width:80%" /><br/>
    文章内容:<textarea name="content" rows="2" cols="20"  style="height:290px;;width:100%;">{$row['content']}</textarea>
    <br/>
    文章作者:<input type="text" name="author" value="{$row['author']}"/><br/>
    上传时间:<input type="text" name="now" value="{$row['now']}" /><br/>
     <input type="submit" value="修改" />
    News;
    }?>
    </form>
    </body>
    </html>
    ////////////////////////////////////////////////////////////
    0.0偶是引用的
    include_once("article.class.php");
    $Article=new Article();
    echo $ret= $Article->update($_GET['id'],"修改后","内容1111111","","");这段代码应该在点击修改的时候调用0.0 现在每次页面进来的时候也会调用。。
    所以 能不能写在action里面 或者有其他的办法 只要点击修改的时候 才去执行
      

  5.   

    //加个判断条件
    if(isset($_POST['submit'])){
        include_once("article.class.php");
       $Article=new Article();
        echo $ret= $Article->update($_GET['id'],"修改后","内容1111111","","");
    }<input type="submit" name="submit" value="修改" />