Easily Create PHP Variables for Every Form Field

Summary

Have you ever wished it were easier to create Software Portability variables based on a form's field keys?

Here's a function that will help you do this with 2-lines of code:

To create the variables, pass the form's key to the function:

/* get all pertinent form and field ids based on key */
$form_field_array = create_init_field_vars_array( "my-form-key" );

/* convert $form_field_array to individual PHP variables */
extract($form_field_array);

After running the PHP extract command, you can access any field by referencing $my_field_key.

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *