I need to take a text that the user inputs into a form, populate a hidden field and slightly manipulate the data prior to saving into the database.
I want "Zebra Print Bikini" to become "zebra-print-bikini" in a different hidden field.
I'm new to php. It seems if the 2nd field in my form contained "Zebra Print Bikini", I would I need to do something like this:
$newVariable = str_replace(" ", "-", input_2);
$newnewVariable = strtolower($newVariable)
In Gravity Forms I think I need to use gform_pre_submission. If the hidden field I want to place the new variable in is the first field in my form, I think I'd need to do something like this:
add_action("gform_pre_submission", "pre_submission_handler");
function pre_submission_handler($form){
$newVariable = str_replace(" ", "-", input_2);
$newnewVariable = strtolower($newVariable)
$_POST["input_1"] = $newnewVariable;
}
And, this goes in my bp_custom.php since I'm using BuddyPress?
Of course, I tried this and it didn't work so I'm asking for assistance. Appreciate it!