Skip to main content

i4w_ifrequest

Usage

This shortcode is designed to check for the existence of a $_REQUEST variable and, given a value to check, for a value match. Any content embedded between the tags will be displayed if the criteria is met.

[ELSE_ifrequest] conditional branching is supported.

Shortcode nesting is supported: [i4w_ifrequest1] thru [i4w_ifrequest19] and [ELSE_ifrequest1] thru [ELSE_ifrequest19]

Parameters

ParameterDescriptionDefaultRequired
requestThe name of the $_REQUEST variable for whose existence you are checking.NoneYes
valA value which the $_REQUEST variable must hold in order to evaluate to true.NoneNo

Example

Will display "Test REQUEST is set" if $_REQUEST['test_request'] exists:

Shortcode
[i4w_ifrequest request='test_request']
Test REQUEST is set
[ELSE_ifrequest]
Test REQUEST is NOT set
[/i4w_ifrequest]

Will display "Test REQUEST is set to 123" if $_REQUEST['test_request'] exists AND its value is 123:

Shortcode
[i4w_ifrequest request='test_request' val=123]
Test REQUEST is set to 123
[ELSE_ifrequest]
Test REQUEST is NOT set to 123
[/i4w_ifrequest]