zoukankan      html  css  js  c++  java
  • php 跳转控制

    <!doctype html>
    <html lang="en">
     <head>
      <meta charset="UTF-8">
      <meta name="Generator" content="EditPlus?">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <title>Document</title>
      <script>
      function jump(){
        window.location="http://localhost:8080/thinkphp/index.php/User/add";
      }
      </script>
     </head>
     <body>
      <h1>scan show 你好 hhhello world</h1>
      <table border='1' width='500' align='center'>
      <tr>
      <th>id</th>
      <th>username</th>
      <th>sex</th>
      <th>操作</th>
      </tr>
      
      <volist name='data' id='vo'>
      <tr>
         <td><{$vo.id}></td>
    	 <td><{$vo.username}></td>
    	 <td><{$vo.sex}></td>
    	 <td><a href="http://localhost:8080/thinkphp/index.php/User/del/id/<{$vo.id}>">删除</a>|<a href="http://localhost:8080/thinkphp/index.php/User/modify/id/<{$vo.id}>">修改</a></td>
      </tr>
      </volist>
      </table>
      <center>
      <button onclick="jump()">添加用户</button>
      </center>
     </body>
    </html>
    
    
    
    添加用户按钮,调用  window.location="http://localhost:8080/thinkphp/index.php/User/add";
    
    
     
      public function add(){
    	
    	  $this->display();
     }
     
     跳转到一个增加用户的页面
     
     <!doctype html>
    <html lang="en">
     <head>
      <meta charset="UTF-8">
      <meta name="Generator" content="EditPlus?">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <title>Document</title>
    
     </head>
     <body>
     <form action="__URL__/create" method='post'>
      id:<input type='text' name='id' /></br>
     姓名:<input type="text" name='username' /></br>
     性别:男<input type='radio' name='sex' value='1' > 
           女<input type='radio' name='sex' value='0'></br>
     <input type="submit" value='添加用户'/></br>
     </form>
     </body>
    </html>
    
    
    
    add.html 里调用__URL__/create 方法:
    
      public function create(){
    		 $m=M('user');
    	 $m->id=$_POST['id'];
    	 $m->username=$_POST['username'];
    	$m->sex=$_POST['sex'];
    	 $idnum=$count=$m->add();
    	 if ($idnum){
    		   $this->success('数据添加成功','index');
    		     #$this->success('数据添加成功');
    	 }else{
    		 $this->error('数据添加失败');
    	 }
    	  
     }

  • 相关阅读:
    期末实训学习认识SSH
    Hibernate 的认识
    action和domain的不同总结
    学习使用action属性来接受参数
    实现action的统配
    struts2学习
    路径问题--笔记
    学习C层
    innovus add_ndr rule
    innovus clock tree instance ccl cdb cwb等 名字命名含义
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199710.html
Copyright © 2011-2022 走看看