将php变量发送到两页

将php变量发送到两页

本文介绍了将php变量发送到两页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个form.html.用户提交表单时,变量将发送到page1.php.此page1.php将名称服务器的输入存储到数据库,进行dig查询,将dig输出存储到数据库,之后该用户将被重定向到form.html.

I have a form.html. When user submit the form the variable will be send to page1.php. This page1.php will store nameserver input to database, make dig query, store the dig output to database and after that user will be redirected to form.html.

麻烦在于dig查询. dig有时可能需要3-5秒才能收到答复,并且用户将被重定向到form.html.那意味着用户必须在form.html处等待3-5秒而没有任何响应,然后才能再次重定向到form.html.

The trouble is with the dig query. It can sometimes take 3-5 seconds before dig get any reply and user will be redirected to form.html. Thats mean the user had to wait with no response at form.html for 3-5 seconds before redirect to form.html again.

我在想这个解决方案. form.html重定向到page1.php. page1.php仅将用户输入重定向到form.html之后,才将用户输入存储到数据库中.同时,page1.php会将用户输入发送到page2.php并进行挖掘查询.所以这实际上是一个问题.如何将数据发送到page1.php并将用户重定向到form.html,同时将数据发送到page2.php进行后台挖掘查询并将挖掘输出存储到数据库.我不知道该怎么做.

I was thinking this solution. form.html redirect to page1.php. page1.php will only store user input to database after that redirect user to form.html. At the same time page1.php will send user input to page2.php and make dig query. So that was the question actually. How do I send data to page1.php and redirect user to form.html at the same time send data to page2.php to make background dig query and store the dig output to database. I don't know how to do that.

因为我不需要瞬时结果,所以我认为我不需要AJAX或jquery来进行挖掘查询.无论如何,用户只会看到从数据库获取的输出.

Since I don't need instantaneous result I don't think I need AJAX or jquery to make dig query. User will just see output taken from database anyway.

谢谢.

推荐答案

我知道您说过您不需要Ajax,但是,我认为这是您最好的选择.看看 jQuery表单插件.它非常容易实现,您可以轻松地使用其回调方法之一进行第二次表单提交.

I know you said you don't think you need ajax, but, I think it's your best and easiest bet. Have a look at the jQuery form plugin. It's incredibly easy to implement and you can easily use one of its callback methods to make your second form submission.

这篇关于将php变量发送到两页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 00:25