如何使用PHP中的模态对话框窗口创建编辑表单 [英] How to Create Edit Form Using Modal Dialog Form in PHP
本文介绍了如何使用PHP中的模态对话框窗口创建编辑表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,有人可以帮帮我吗?
当我点击按钮输入,编辑和删除时,我想使用对话框在一个页面中创建一个CRUD PHP表单。但是,只有我能创造的功能。我使用这个脚本:
$(document).ready(function(){
$(function(){
$(#input-user)。dialog( {
autoOpen:false,
resizable:false,
modal:true,
width:'auto'
});
$(#onclick )。on(click,function(){
$(#input-user)。dialog(open);
});
});
});
适用于输入。但是,对于编辑表单,我无法创建它。因为,我不理解使用对话框开发编辑脚本的概念。
这是HTML:
< div id = edit-user >
< h1 > 编辑用户< / h1 >
< 表格 action = 方法 = 发布 >
< label class = field = 全名 > 全名:< /标签 > < 输入 class = 输入明亮 type = text 名称 = fullname < span class =code-attribute> id = fullname >
< 标签 class = field for = 用户名 > 用户名:< / label > < span class =code-keyword>< input class = 输入明亮 type = text name = 用户名 id = 用户名 >
< 输入 class = 输入提交 type = 提交 name = 提交 value = 提交 >
< / form >
< / div >
这是列表数据:
< tr class = < span class =code-keyword> alt >
< th > 否< / th >
< th > 全名< / th >
< th > 用户名< / th >
< th > 操作< / th >
< / tr >
<? php
$ query_view = select * from user ;
$ no = 0;
$ view_user = mysql_query($ query_view) 或 DIE(mysql_error());
while($ rows = mysql_fetch_array($ view_user))
{
$ no ++; 跨度> < span class =code-summarycomment>
? >
< tr >
< td > <? php echo $ no;? > < / td >
< td > <? php echo $ rows ['full_name']? > < / td >
< td > <? php echo $ rows ['username']? > < / td >
< td > < input 名称 = 编辑 type = image src = images / edit.png width = 20px height = 23px title = 编辑用户 id = editclick > < / td >
< span class =code-keyword>< / tr > <? php }? >
解决方案
(文件).ready(function(){
(function(){
(#input -user)。dialog({
autoOpen:false,
resizable:false,
modal:true,
width:'auto'
});
Hello, could someone help me??
I want to create a CRUD PHP form in one page using dialog box when I click button input, edit and delete. But, only Create function that I can made. I use this script:
$(document).ready(function() {
$(function() {
$("#input-user").dialog({
autoOpen: false,
resizable: false,
modal: true,
width: 'auto'
});
$("#onclick").on("click", function() {
$("#input-user").dialog("open");
});
});
});
It works for input. But, for edit form I can't create it. Because, I don't understand the concept to develop script for edit using dialog box.
this is the HTML:
<div id="edit-user">
<h1>Edit User</h1>
<form action="" method="post">
<label class="field" for="Fullname">Full Name : </label><input class="input bright" type="text" name="fullname" id="fullname">
<label class="field" for="Username">Username : </label><input class="input bright" type="text" name="username" id="username">
<input class="input submit" type="submit" name="submit" value="submit">
</form>
</div>
this is list data:
<tr class="alt">
<th>No</th>
<th>Full Name</th>
<th>Username</th>
<th>Action</th>
</tr>
<?php
$query_view = "select * from user";
$no = 0;
$view_user = mysql_query($query_view) OR DIE(mysql_error());
while($rows = mysql_fetch_array($view_user))
{
$no ++;
?>
<tr>
<td><?php echo $no;?></td>
<td><?php echo $rows['full_name']?></td>
<td><?php echo $rows['username']?></td>
<td><input name="edit" type="image" src="images/edit.png" width="20px" height="23px" title="Edit User" id="editclick""></td>
</tr><?php }?>
解决方案
(document).ready(function() {
(function() {
("#input-user").dialog({ autoOpen: false, resizable: false, modal: true, width: 'auto' });
这篇关于如何使用PHP中的模态对话框窗口创建编辑表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文