数据传输
table width="100%" border="0" cellspacing="0" cellpadding="0" class="ttbb5"> <tr> <th scope="col"><strong>序号</strong></th> <th scope="col">国家</th> <th scope="col">省份</th> <th scope="col">地区</th> <th scope="col">操作</th> </tr> {if $list or $list|@count neq 0 } {foreach from=$list item=item key=index} <tr align="center"> <td>{$index}</td> {if $item.parent_tow_id eq 2} <td class="ttbb6">{$item.country}</td> <td class="ttbb6">{$item.province}</td> <td class="ttbb6">{$item.name}</td> {/if} {if $item.parent_tow_id eq 1} <td class="ttbb6">{$item.country}</td> <td class="ttbb6">{$item.name}</td> <td class="ttbb6"></td> {/if} {if $item.parent_tow_id eq 0} <td class="ttbb6">{$item.name}</td> <td class="ttbb6"></td> <td class="ttbb6"></td> {/if} <td align="center" class="ttbb6"> <div align="right"> <input name="p" type="text" id="p" value="{$item.paixu}" size="5" maxlength="3" /> <input type="button" class="anniu4" value="确定" onclick="foo()" /> </div></td> </tr> {/foreach} {else} <tr> <td align="center" colspan="5">--暂无数据--</td> </tr> {/if} </table> {include file=warning.tpl}</div> </td> </tr></table>
input=text显示数据库排序的值 在文本框修改值点击确定 怎么传入数据库 改变paixu的值
回复讨论(解决方案)
使用ajax,获取数据后,异步传递到php
可以通过jquery来判断是否出发点击修改之操作,然后通过ajax到php修改值后再返回信息
点击“确定”时,获取当前那一行栏目的id和paixu的值,把值发送到控制器,根据主键id去修改paixu的值,成功时,返回1,失败返回0。回调函数里接收到1就alert成功,否则alert失败。
你还可以直接把整个表单做成form表单,Input的name用{$item.id},value用{$item.paixu}。
提交到控制器里,foreach遍历$_POST,$k作为id,$v作为paixu的值,一条一条插入到数据表里。
点击“确定”时,获取当前那一行栏目的id和paixu的值,把值发送到控制器,根据主键id去修改paixu的值,成功时,返回1,失败返回0。回调函数里接收到1就alert成功,否则alert失败。
你还可以直接把整个表单做成form表单,Input的name用{$item.id},value用{$item.paixu}。
提交到控制器里,foreach遍历$_POST,$k作为id,$v作为paixu的值,一条一条插入到数据表里。
如果这个不会呢 你说的这个方法也是ajax是吧 这个怎么调用啊
参考手册吧,用jQuery来进行ajax操作比原生ajax方便,具体的方法还是看手册吧。
http://www.php100.com/manual/jquery/
实在不想用ajax来发送,就按我说的第二种方法来直接发到控制器里处理吧,不过需要改下模板的代码
参考手册吧,用jQuery来进行ajax操作比原生ajax方便,具体的方法还是看手册吧。
http://www.php100.com/manual/jquery/
实在不想用ajax来发送,就按我说的第二种方法来直接发到控制器里处理吧,不过需要改下模板的代码
虽然还是没有解决 不过谢谢你
jquery 异步获取数据,js请求一次,传递上一级的pid,对象返回下一级的数据。
ajax可以参考 http://www.w3school.com.cn/jquery/jquery_ajax_get_post.asp
jquery 异步获取数据,js请求一次,传递上一级的pid,对象返回下一级的数据。
能不能帮忙写下代码啊, 我不会。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

When many friends change their Apple phones, they want to import all the data in the old phone to the new phone. In theory, it is completely feasible, but in practice, it is impossible to "transfer all" the data. This issue's article List several ways to "transfer part of the data". 1. iTunes is a pre-installed software on Apple mobile phones. It can be used to migrate all data in old mobile phones, but it needs to be used in conjunction with a computer. The migration can be completed by installing iTunes on the computer, then connecting the phone and computer via a data cable, using iTunes to back up the apps and data in the phone, and finally restoring the backup to the new Apple phone. 2. iCloudiCloud is Apple’s exclusive “cloud space” tool. You can log in to your old phone first.

ReactAPI Call Guide: How to interact with and transfer data to the backend API Overview: In modern web development, interacting with and transferring data to the backend API is a common need. React, as a popular front-end framework, provides some powerful tools and features to simplify this process. This article will introduce how to use React to call the backend API, including basic GET and POST requests, and provide specific code examples. Install the required dependencies: First, make sure Axi is installed in the project

With the development of science and technology, network communication has become one of the important tools for information transmission in modern society. But at the same time, information transmission on the network faces the risk of malicious attacks and theft, so security is particularly important. Based on this, the HTTPS protocol came into being. It is a protocol that adds SSL/TLS encryption to the HTTP protocol to ensure network transmission security. As a language widely used in network development, Java naturally provides a rich API to support the HTTPS protocol. This article will

PHPtraitDTO: A key tool for optimizing the data transfer process, specific code examples are required Overview: In PHP development, data transfer is a very common task, such as passing data from the controller to the view, passing data from the interface to the front end, etc. However, in the process of transmitting data, the data often needs to be processed, converted and encapsulated, which may lead to code redundancy and difficulty in maintaining. To solve this problem, we can use PHPtraitDTO (DataTransfer

PHPtraitDTO: A key tool for optimizing the data transmission process. Specific code examples are required. Introduction: During the development process, data transmission is a very common requirement, especially when data is transferred between different levels. In the process of transmitting this data, we often need to process, verify or convert the data to meet different business needs. In order to improve the readability and maintainability of the code, we can use PHPtraitDTO (DataTransferObject) to optimize

How to call API interface in PHP to realize data transmission and processing? With the development of the Internet, the use of various Web services and API interfaces is becoming more and more common. An API (Application Programming Interface) is a technical specification that allows data interaction between different applications. As a scripting language widely used in web development, PHP has powerful and flexible API calling capabilities. This article will introduce how to use PHP language to call API interface to realize data transmission and processing. 1. Preparation before calling the API

Practical introduction to peripheral device control and data transmission functions of C++ in embedded system development: As a technology with a wide range of applications, embedded systems are widely used in many fields, such as automobiles, home appliances, medical equipment, etc. In embedded system development, peripheral device control and data transmission are a very important function. This article will introduce how to use C++ language to implement the control and data transmission functions of peripheral devices, and provide practical code examples. 1. C++ Peripheral Device Control Function Practice In embedded systems, peripheral device control refers to the

How to use PHP to encrypt data transmission to ensure communication security. With the continuous development of the Internet, the security of data transmission has become a topic that continues to receive attention. During the data transmission process, if encryption is not performed, the data can easily be intercepted maliciously, leading to the leakage of private information or data tampering. Therefore, it becomes very important to use encryption technology to ensure the security of data transmission. As a widely used server-side programming language, PHP can play a big role in website development. PHP provides a variety of methods for encrypting data transmission and
