简体   繁体   English

处理PHP没有刷新页面

[英]process php whithout refreshing page

I have a problem with process to insert database, I have 3 tables and I want to proccess 3 tables alternately. 我在插入数据库的过程中遇到问题,我有3个表,我想交替处理3个表。 example : I want to process insert into table A , from data table A continue to table B, and from data table B continue to table C whithout refreshing page, I want use Ajax , is there any script to used? 示例:我想在没有刷新页面的情况下,将数据插入表A,从数据表A继续至表B,从数据表B继续至表C,我想使用Ajax,是否有要使用的脚本? my script this : 我的脚本是这样的:

<?php 
break;
    case submit :
@mysql_query("INSERT INTO table_A(id,field1,field2,field3,date) VALUES ('','$field1','$field2','$field3','$datenow')");
echo "<meta http-equiv='refresh' content='0;URL=index.php?mod=process&act=step1'>";
break;
    case step1 :
@mysql_query("INSERT INTO table_B (id,field1,field2,field3,date) VALUES ('','$field1','$field2','$field3','$datenow')");
echo "<meta http-equiv='refresh' content='0;URL=index.php?mod=process&act=step2'>";
break;
    case step2 :
case step1 :
@mysql_query("INSERT INTO table_C (id,field1,field2,field3,date) VALUES ('','$field1','$field2','$field3','$datenow')");
echo "<meta http-equiv='refresh' content='0;URL=index.php?mod=process&act=OK'>";
?>

I think you need to go through some documentations and try to do something. 我认为您需要阅读一些文档并尝试做一些事情。

Learn what is ajax and use javascript here: http://www.w3schools.com/js/js_ajax_intro.asp 在这里了解什么是ajax并使用javascript: http : //www.w3schools.com/js/js_ajax_intro.asp

Use jquery for ajax here: http://www.w3schools.com/jquery/jquery_ref_ajax.asp 在此处将jquery用于ajax: http : //www.w3schools.com/jquery/jquery_ref_ajax.asp

Finally switch statement syntax: http://www.w3schools.com/php/php_switch.asp 最后切换语句的语法: http : //www.w3schools.com/php/php_switch.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM