creating madlibs in php

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!

Moderator: General Moderators

Post Reply
kavkazi
Forum Newbie
Posts: 3
Joined: Wed Nov 24, 2010 1:50 pm

creating madlibs in php

Post by kavkazi »

I am trying to create a madlibs game ..

I have a txt file with paragraphs in it .. Some of the sentences have the following tags in it <#noun>, or <#verb>, etc ...

I need to parse the file in php and display the content in between the tags to the user.

The user can fill the the words in text box, and the story will be displayed with the new words instead of the tags.

Here is an example of the text file:

One day, I was walking through the <# adjective #> part of
Toronto when I ran into a huge stack of <# plural noun #>!
It was the most <# adjective #> sight I had ever seen. I tried
to call my best friend, <# proper noun #>, to tell <# him/her #>
about it but all of the phone circuits were busy.

Thanks in Advance,
Vladimir
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: creating madlibs in php

Post by cpetercarter »

Are the textboxes on the same page as the paragraph of text? If so, I would use Javascript to replace <#verb> etc with the contents of the textboxes.
kavkazi
Forum Newbie
Posts: 3
Joined: Wed Nov 24, 2010 1:50 pm

Re: creating madlibs in php

Post by kavkazi »

It's on two different pages. Thx
Post Reply