Hello folks. I am new to these forums and have something, which has been stumping me for little while.
I am using pspell to spellcheck a scrolling textbox (textarea) containing user input.
I analyze each word and rebuild the text string as a combination of correct text (not misspelled) and a drop down list offering suggestions in place of any misspelled words. Pretty common stuff using pspell.
I display the new string so that the user can select a replacement word from the drop down lists. Each drop down list is programatically named as created as <select name="position[$pos]"> with $pos being its actual position in the original text string. Makes it easier to keep track of where the list belongs. All of that works fine.
On to the question... Once the user has selected replacement words and clicks the "Done" submit button, I call the same PHP script again and now have a string, which for example looks like:
How many times did the [big] brown [dog] jump over the [fence]?
Where big, dog and fence are actually the drop down lists with the selections made to correct "bigg", "dogg" and "fense" misspellings respectively.
The question: Using PHP, How can I parse the complete string, resulting in one string with the drop down lists removed and only the text remaining?
i.e. the string would be "How many times did the big brown dog jump over the fence?"
Handling the regular text has presented no problems, but I have been unable to detect and extract the drop down values in between. The obvious problem stems from the drop down lists using html tags to define them.
Any suggestions and/or examples will be greatly appreciated.
I am using pspell to spellcheck a scrolling textbox (textarea) containing user input.
I analyze each word and rebuild the text string as a combination of correct text (not misspelled) and a drop down list offering suggestions in place of any misspelled words. Pretty common stuff using pspell.
I display the new string so that the user can select a replacement word from the drop down lists. Each drop down list is programatically named as created as <select name="position[$pos]"> with $pos being its actual position in the original text string. Makes it easier to keep track of where the list belongs. All of that works fine.
On to the question... Once the user has selected replacement words and clicks the "Done" submit button, I call the same PHP script again and now have a string, which for example looks like:
How many times did the [big] brown [dog] jump over the [fence]?
Where big, dog and fence are actually the drop down lists with the selections made to correct "bigg", "dogg" and "fense" misspellings respectively.
The question: Using PHP, How can I parse the complete string, resulting in one string with the drop down lists removed and only the text remaining?
i.e. the string would be "How many times did the big brown dog jump over the fence?"
Handling the regular text has presented no problems, but I have been unable to detect and extract the drop down values in between. The obvious problem stems from the drop down lists using html tags to define them.
Any suggestions and/or examples will be greatly appreciated.
Comment