PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
How can a ask the user to enter a bit of text in STDIN but present them with a default value (for example, the one they last used) which they can either edit, backspace out or just use?
<?php
echo "Enter something: ";
fwrite(STDIN, 'Foo');
$line = fgets(STDIN); //User sees "Enter something: Foo -- but godammit they can't backspace the word Foo out again"
echo "\n\n$line";
?>
I don't want to have to use readline or ncurses and I'm guessing it's not even needed.
Then if you press enter, without typing anything, it defaults to 25. Maybe you can do it like that?
I thought of that but I wanted the user to be able to make minor edits to the previous text entered -- it's for naming stuff and the names vary only slightly.
I guess I'll use readline since I have PHP set up with it but I'll have to learn how to use it Fun fun fun Thanks guys.