Send php variable to two pages

2019-07-18 02:08发布

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.

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.

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.

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.

Thanks in advance.

标签: php forms
2条回答
仙女界的扛把子
2楼-- · 2019-07-18 02:49

Since you don't want to use Ajax, how about passing the information via a hidden iframe to make the dig query on the first page that you process the submit information?

查看更多
小情绪 Triste *
3楼-- · 2019-07-18 03:06

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.

查看更多
登录 后发表回答