How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask TheDoctor Your Own Question

TheDoctor, Professional w/Adv. Degree
Category: Homework
Satisfied Customers: 1757
Experience:  M.S. in Internet Information Systems
Type Your Homework Question Here...
TheDoctor is online now
A new question is answered every 9 seconds

Need PHP code rewritten

This answer was rated:

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 :

Hi, I'm a Moderator for this topic. I've been working hard to find a professional to assist you right away, but sometimes finding the right professional can take a little longer than expected.

I wonder whether you're ok with continuing to wait for an answer. If you are, please let me know and I will continue my search. If not, please let me know and I will cancel this question for you. Thank you!
Customer: replied 3 years ago.

I will continue to wait today, perhaps the person who has helped me before, Eljon can help?

Thank you for your continued patience. Your requested professional, Eljon, is unable to assist on this question. We will continue the search for a professional for you.

You need to spend $3 to view this post. Add Funds to your account and buy credits.
TheDoctor, Professional w/Adv. Degree
Category: Homework
Satisfied Customers: 1757
Experience: M.S. in Internet Information Systems
TheDoctor and 4 other Homework Specialists are ready to help you

Related Homework Questions