I am trying to create a PHP script where I ask the user to select an option: Basically something like:
echo "Type number of your choice below:"; echo " 1. Perform Action 1"; echo " 2. Perform Action 2"; echo " 3. Perform Action 3 (Default)"; $menuchoice = read_stdin(); if ( $menuchoice == 1) { echo "You picked 1"; } elseif ( $menuchoice == 2) { echo "You picked 2"; } elseif ( $menuchoice == 3) { echo "You picked 3"; }
This works well, as you can perform certain actions based on user input.
But I would like to expand this so that if the user does not type something within 5 seconds, the default action will be launched automatically without any further user actions.
Is this even possible with PHP ...? Sorry, I'm starting this thread.
Any guidance is appreciated.
Thanks,
Hernando
source share