Wait for input

  • natas
  • PHP Ninja
  • Proficient
  • No Avatar
  • Joined: Mar 28, 2009
  • Posts: 305
  • Loc: AFK
  • Status: Offline

Post June 26th, 2010, 8:16 pm

Is there a function in PHP that will allow a script to wait for user input before continuing the script.

The problem I have is that if a user inputs a value and that value exists already in the database, they will have the option to either overwrite the existing field or enter a new value.

I know I can do this with a form, but just curious as to if I can do it another way.
Custom Web Design
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 26th, 2010, 8:16 pm

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post June 26th, 2010, 11:14 pm

You might be able to do it with ajax, but not really sure.
#define NULL (::rand() % 2)
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post June 27th, 2010, 3:47 pm

You can not interrupt a request / response iteration with sub-queries and continue the previous request / response after the sub-query. Any interruption will scrap the current transaction.

--

When you see things like "Check if this username exists" in user registration forms, they're using AJAX like spoof mentioned to ask the server if the name exists.

Could something like that work for you ? A button that the user can click to see if the value exists ?

There could also be a checkbox to signal the overwrite.
Strong with this one, the sudo is.
  • natas
  • PHP Ninja
  • Proficient
  • No Avatar
  • Joined: Mar 28, 2009
  • Posts: 305
  • Loc: AFK
  • Status: Offline

Post June 28th, 2010, 5:30 am

Thanks! I will definitely look into AJAX.
Custom Web Design
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post June 28th, 2010, 7:18 am

If you're not sure where to start, maybe having a look at jQuery won't hurt. Using jQuery's ajax is pretty simple.
Let's leave all our *plum* where it is and go live in the jungle ...

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: demonmaestro and 132 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.