Jump to content


This topic is now archived and is closed to further replies.


pause the php script

Recommended Posts

Is there a way to pause the working of a script and then wait something from user and then continue to work?

It does not look possible thought. Well that's for submitting a form. Like this one you send a post. While sending it checks if you are logged in or not. If you are it submits the post. But if you're not wait for user to login and then continue to post.

Or should I keep the post datas on hidden values then check for the user's login and then redirect the user to the form page filled from hidden input fields and then ask the user to resubmit it?

Any other ways are welcome too.

Share this post

Link to post
Share on other sites
I'm not sure how long $_POST variables live, but if you're using sessions you could do a check on the form processing page that sees if the user is logged in, and if they're not, put the form data the wrote into some session variables and use them for the value in the original form. 

You can do a quick check for the form that sees if there is any user data stored in variables, like
echo "<input name=blah type = text";
if(isset($_SESSION['title'])) {
  echo " value=" . $_SESSION['title'];
echo ">";

So if you put something along those lines in the original form, if they try to submit something without logging in you can send them somewhere to have them login and still have the stuff they wrote stored in variables. 

Share this post

Link to post
Share on other sites
In a technical sense, no. Asynchronous requests are not possible with php. JavaScript's XMLHttpRequest offers a work around, but even that technically is not Asynchronous, despite it having that buzzword associated with it.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.