I am building a job board on our Wordpress website and each job has an Apply Now but which redirects to a form. Rather than build a new form for each job, I am trying to pass the Job Title (which is the page title) to the form but cannot get it to work.
So the button is located on this page for example:
Page title is Engineering Job
The code for the button I'm trying is this..
<button onclick="window.location.href='http://mywebsite.com/careers/apply/?job_name=". $_GET["$title"] ."'">APPLY NOW</button>
You could use WordPress'
wp_title() function and then
urlencode() to properly encode all special characters.
<button onclick="window.location.href='http://mywebsite.com/careers/apply/?job_name=<?php echo urlencode(wp_title(' ', FALSE)); ?>'">APPLY NOW</button>