Mad Libs

Using randomized PHP to generate unique stories. Also allows users to input words into a form to create their own Mad Lib stories.

Skills Used: HTML, CSS, PHP


View Project
Original homework assignment submission.

Discovery

Earlier in the semester, we were given a homework assignment where we had to create a website that gave users the ability to create their own Mad Lib story. In addition to this, we were given the task of using randomized PHP to generate unique Mad Lib stories each time a page is refreshed. After creating arrays of word variables for nouns, verbs, names and places, I set the PHP shuffle() function to randomize the order of the arrays' elements.


A Mad Lib story usually requires a theme or setting that ties the words together. For the homework assignment, I created a website that used an excerpt from Harry Potter and the Chamber of Secrets, with users would replacing multiple words in the story using a PHP form. However, looking back at this completed project months later, I found that there were several key ways that I could improve the website.

Excerpt of arrays used to generate random Mad Libs.

Ideation

First and foremost, the stories used for the Mad Libs needed to be more clearer and more concise. Instead of using copy that was written to have specific words strung together, I wrote the backbones for each Mad Lib myself. I also wanted to provide more choice for the user, so I created 3 stories that they can construct themselves, as well as a random Mad Lib generator that places shuffled word elements into shuffled stories.

Composition

    11 webpages
  • 4 PHP forms
  • 3 user-generted Mad Lib stories
  • 3 randomized Mad Lib stories
  • 1 Index page
    5 .inc.php Files
  • arrays.inc.php
  • config.inc.php
  • html-bottom.inc.php
  • html-top.inc.php
  • nav.inc.php