Working on a small project with PHP spell checking features (pspell) and wind up with strings containing both plain text (properly spelled words) and drop down lists (misspelled word suggestions) such as:
The large brown [dog] ate my [homework].
Where words in brackets are drop down lists containing the corrected spelling choices of the user, say from the original text string "The large brown dogg ate my homwork". Pretty typical pspell stuff.
My question: How can you parse a text string mixed with both plain text and drop down lists as above?
Obviously, I am looking for a final string of just text as in "The large brown dog ate my homework". No more drop down lists.
I attempted to capture the drop down list values via $_POST, but the problem is that the number of drop down lists, their names and their values will obviously change each time new text is entered and spelling errors are detected.
What I am looking for is a function capable of parsing the initial string, keeping plain text words and punctuation, but replacing the drop down lists with their selected values. Hopefully this all makes sense.
Have looked at many pspell examples and they all seem to go to the point of presenting the string with drop down lists inserted and then end there with no examples or instructions on rebuilding the final string for presentation back to the form/user.
I appreciate any and all advice and examples.