Jump to content

kavkazi

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by kavkazi

  1. yes, i've already extracted the text between the hashes. The problem is, the text between the hashes doesnt always contain a slash. Sometimes it can be just a regular text. For example: $string = array('Hello', 'string/with', 'Hi Pals', 'and/more/delineated', 'random/slashes/and/text');
  2. Hi, I need to analyze a string and get the text between, before, and after the forward slashes.. The string will always look something like this, but will vary: $str = "I will go to the store with <# one/two/three #> people." Then I need to create a form with radio buttons for each choice. In this case (one, two, or three). The text between the <# ... #> could be different every time, and with uknown amount of forward slashes. Here is what I have so far but it doesn't work. Code to find if there are slashes: preg_match_all( '/([/]+)/',$str,$matches); Code to create html form .. $i = 0; $html = '<form>'; foreach ($matches[0] as $match){ if ($pos = strpos( $str,$match ) ) === false ) continue; } $html .= '<input type="radio" name="place-' . $i . '" value=". $match . '" /> '; } $html .= '</form>'; Its not working as needed. I'm not sure how to create radio button choices for the words (one, two, three). Thanks
  3. Attached is an example of a text file [attachment deleted by admin]
  4. sorry, I have spent lots of time on google and only got more confused. I would really appreciate if anyone can put this into php code, and I can play around as needed. I don't understand why i need to use sql escape if i dont have a database or table.. its just a txt file with some parapgraphs. Thanks for your help.
  5. Thanks for your reply Rifts .. but im looking for something else. I need to parse the story for the tags <# ... > The story is in a text file, and it can be replaced with another sotry. Therefor i need to parse the tags and create the form inputs dynamically .. the php should read the story from a txt file .. show all the tags in the story to the user, with ability to provide words in that place. And finally display the story with the replaced words to the user. Thanks
  6. 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. I am new to php. Any help greatly appreciated. Thanks in Advance, Vladimir
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.