Server-side scripting language for web development
Step-by-Step example
Create a directory for this lab and download this file as "index.php" to get you started with the exercise.
Write a PHP script to print out the following string:
Now add to your script and declare a variable called game and append it to another echo statement that prints both the variable and the following:
Instantiate game with the value of.. your favorite game! Feel free to replace that with your favorite videogame, movie, or music genre.
Copy this HTML code into your PHP file. This will make a small input submission box that can send data through the POST method in HTTP. Using PHP, you can access this with $_POST, which is a default PHP global variable that is treated as a key-value pair map.
Update your script to take in input and display the user's favorite boardgame, videogame, music genre, movie, or whatever you chose.
Construct an array of 5 elements that answer your question above.
Then, check if the value of game exists in the array. Display a message if it does and another if it does not exist.
View this data file and copy the text related to your question into a separate .txt file (for example, if you asked for a boardgame name, copy the 10 names under ~BOARDGAMES~).
Open the file and construct an array from its contents. Try to use sort() in PHP to reorder the list in any way you want. Update your previous form submission to use the list from the file rather than your own list (you may add your other items into this list to make it longer if you wish). Finally, print out the array as an ordered list in HTML only after their value is submitted.