galvin Posted April 29, 2009 Share Posted April 29, 2009 I have found a way using Javascript to do the following, but I'd like to know if there is a way to do it using PHP... I have a single text file where users enter answers that are stored in an array. If whatever "guess" they enter in the field matches any of the answers in the array, the answer immediately displays on the screen in a list below the main "guessing" field. So if "mother" was in the array and the user typed "mother" into the guessing field, as soon as the "KeyUp" from the letter "r" occured, Javascript sees that it matches an answer exactly and does it's thing to make it show up somewhere else (and also wipe clear the guessing field so that it's ready for a new guess). Is this same thing possible with PHP, or, because it's server side, can PHP not really compare on the fly like javascript is doing? In other words, I feel like there would have to be a "Submit" button to send the "guess" to the server to do any PHP comparisons. Is that right? I really need the comparison to occur AS SOON AS the guess matches the answer, so I really dont want to make the user click a Submit button. If this simply can't be done using PHP, that's fine, I just want to find out either way. Let me know what you think. Thanks Greg Link to comment https://forums.phpfreaks.com/topic/156102-is-this-type-of-thing-possible-with-php/ Share on other sites More sharing options...
Kalland Posted April 29, 2009 Share Posted April 29, 2009 You're right it can't be done by php alone. Link to comment https://forums.phpfreaks.com/topic/156102-is-this-type-of-thing-possible-with-php/#findComment-821725 Share on other sites More sharing options...
Mchl Posted April 29, 2009 Share Posted April 29, 2009 It is possible however with PHP + AJAX Link to comment https://forums.phpfreaks.com/topic/156102-is-this-type-of-thing-possible-with-php/#findComment-821747 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.