Getting form values

This documentation page is for Quform version 1 and may not be applicable for Quform 2 click here to visit the documentation for Quform 2.

This guide will explain how to get access to any submitted form data inside action or filter hook functions. These functions are usually used to modify the behaviour of the plugin or perform custom actions.

Get a single form value

1. Get your unique Quform element ID for the form element using this guide.

2. Inside the Quform hook PHP function you can use the following code, then replace iphorm_X_X with the unique element ID from Step 1.

1
$value = $form->getValue('iphorm_X_X');
$value = $form->getValue('iphorm_X_X');

$value now contains the submitted form value for element iphorm_X_X

Get all form values

To get all form values use the code below.

1
$values = $form->getValues();
$values = $form->getValues();

$values now contains all the submitted form values in an associative array. The element unique ID is the array key and the submitted value is the array value. Below is an example of the contents of $values after a form has been submitted.

1
2
3
4
array(
    'iphorm_1_1' => 'My Name',
    'iphorm_1_2' => 'me@example.com'
)
array(
    'iphorm_1_1' => 'My Name',
    'iphorm_1_2' => 'me@example.com'
)

Data types of the form values

The data types of the form values may vary depending on the type of the element. In the table below the data type for each each element and an example are shown.

ElementTypeExample
Single Line Textstring‘Foo’
Paragraph Textstring‘Foo’
Email Addressstring’email@example.com’
Dropdown Menustring‘Foo’
Checkboxesarray
array(
    0 => 'Chosen Option 1',
    1 => 'Chosen Option 2'
)
Multiple Choicestring‘Foo’
File Uploadarray
array(
    0 => array(
        'url' => 'http://www.example.com/path/to/the/file.jpg',
        'text' => 'file.jpg',
        'fullPath' => '/home/example.com/public_html/path/to/the/file.jpg'
    ),
    1 => array(
        'url' => 'http://www.example.com/path/to/the/second-upload.jpg',
        'text' => 'second-upload.jpg',
        'fullPath' => '/home/example.com/public_html/path/to/the/second-upload.jpg'
    )
)
Datearray
array(
    'day' => '23',
    'month' => '11',
    'year' => '2012'
)
Timearray
array(
    'hour' => '11',
    'minute' => '58',
    'ampm' => 'pm'
)
Hiddenstring‘Foo’
Passwordstring‘Foo’
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy