Pass dynamic data from a link to a form

In WordPress, use the following to extract a string from a URL:

$jobreference = $_SERVER['QUERY_STRING'];

So from a previous page you can add a dynamic string to a link. When it leads to a contact form, the unique string can be extracted and echoed into a form field. For example, from:

http://www.website.co.uk/page?string

$jobreference will be: “string”

Advertisements

%d bloggers like this: