$__SESSION is a PHP global variable that exists apart from WordPress/Formidable. I don't know what you mean when you say you have a text field with the $SESSION['symbol'] the user enters "IBM 132". You can use $__SESSION variables as default values but you can't assign values to them in a Formidable text field. You can capture a value in a Formidable text field and assign it to $__SESSION['symbol'] with jQuery or PHP after its been captured in a field.
Here's how you would do it in jQuery in the browser before a form submit: https://ciphertrick.com/session-handling-using-jquery/
PHP can do this after a form submit by using the frm_pre_create_entry filter where you can construct and sanitize your URL before using it.
Hi,
Thanks for your reply. Perhaps I can be clearer.
The user enters "IBM 132" into a Formidable Form text field say $_POST['item_meta'][6] where '6' is the id of the field. I would like to Trim the text so that it reads:
1) IBM132 (without the space) and
2) IBM%20132 (with %20 - representing a space).
Hope this clarifies.
Thanks!
You are asking for two completely different formats for a single field. If you remove the spaces like your example 1, there are no spaces to sanitize with %20 as you want in example 2. If you want two different fields, either that or settle on one format or the other for a single field.
That being said, you can either format with jQuery wither with a regular expression or character substitution. Here's an example with regular expressions: https://stackoverflow.com/questions/7151159/javascript-regular-expression-remove-spaces
Thist example show how to convert characters to HTML Entities. You can modify this code to convert a space to %20. https://javascript.plainenglish.io/javascript-algorithm-convert-html-entities-99719d8ca118
Please login or Register to submit your answer