Jump to content

pause the php script


radalin

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.
Link to comment
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. 
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.