I’m working on a relatively simple plugin that simply adds a message to the header or footer of your blog. This message is configurable and is done so on its own options page in a textbox.
When I type in a message and update the options, it usually properly saves the text in the text box to the database. However; when dealing with certain characters such as the single-quotation, the text from the quotation mark to the rest of the text is cut off. So “Hello, I’m testing something.” would produce “Hello, I” when the variable is updated.
Given my setup, I am unsure how I can validate or stop the text from being cut off before it gets updated. Here is a trimmed version of the code I’m using.
//Begin Footer Message Text Option echo "<p><strong>Message:</strong><li><input class='DS_SWM_Options_LongText' type='text' id='ds_MSG' name='ds_MSG' value='" . $ds_MSG . "'></li></p>"; //End Footer Message Text Option //Begin Update Buttons And Setting Up Variable Saving echo "<p class='submit'><input type='submit' name='Submit' value='Update Options' /></p>"; echo "<input type='hidden' name='action' value='update' />"; echo "<input type='hidden' name='page_options' value='ds_MSG'/>"; echo "</form>"; //End Update Buttons And Setting Up Variable Saving
I was thinking that I could use a hook to intercept the variable before it gets sent to the database, but I only came up with a hook to deal with the variables after the update has occured, which doesn’t really benefit me if the text is being stripped beforehand.
How do you think it can be done?
- The topic ‘Validating Textboxes Before Updating Database’ is closed to new replies.