Homework Questions? Ask a Tutor for Answers ASAP
rewrite the program to read both the fixed text and the input values from a data structure. Making this change will simplify the transition to a database-driven application. Declare 2 PHP arrays. One will hold the blocks of fixed text. The other will hold the prompts for the input fields. You may name these "$content" and "$prompt", respectively. At the beginning of your program, initialize the values for these arrays. You can simplify the program logic by using the first prompt for a story title, such as the following: $prompt = array('Story title', 'Time', 'Person'); Then, on each line of the display, output one element of the $prompt array followed by a text input box. If you name that input box with the current subscript from the $prompt array, it will be easy to store the user's input into the corresponding element of the $content array. You may want to experiment with reading these values from a text file. Next, create the input fields. Create one input field for each element in the $prompt array; display the element values user prompts. For simplicity, use text boxes for all input fields. You will need a PHP loop to do this; if you use for loop, use the count function to tell how many elements the array holds. It will be convenient to use the array index value as the name for each input field. Ensure that the text boxes display properly, then rewrite the story generator as a loop. It should display the text for the first input field, the first content element, the text for the second input field, the second content element, and so on. Check that the story displays correctly. Are you inserting spaces between the content and the input text? Try modifying a few details of the story. You should only have to change the data arrays, not the program logic. The link to the file that needs to be modified is at : http://wikisend.com/download/721068/madlib.php
I will continue to wait today, perhaps the person who has helped me before, Eljon can help?