Pull Variable from URL  Use php template

Jon Imms
Jon Imms used Ask the Experts™
on
Not sure how this can be done.  I am creating both an Email and landing page Template.

The email will be a drip campaign from our CRM, which will have links in them which goto a landing page on our wordpress website

the links in the email will be something like https://mysite.com/landing-page?john-smith

What i would love to do, is create a template in wordpress, which could scrape the incoming url,  and get the name,  so that we could have a Welcome John Smith headline,   and John multiple places in the content so it's a personal landing page.

So email is sent out, which has the link https://mysite.com/landing-page?john-smith included in it.  

They click on the link, and it takes you to a Wordpress Landing Page.

Welcome {firstname} {lastname}  (Welcome John Smith)

Dear {firstname},    Dear John,

Is this possible, and how can this be done in PHP, Wordpress.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Top Expert 2016
Commented:
You want to change this URL design:

https://mysite.com/landing-page?john-smith

Change it to something like this:

https://mysite.com/landing-page?q=john+smith

Then in your landing-page PHP script you will find the $_GET array has a key named "q" and a value with "John Smith" which you can explode() to get the first name and last name.

That said, you don't really want a design exactly like this.  The same functionality can be achieved with a more secure structure that does not pass client information over email and in the URL.  Instead you want to send the email with a key to a row of the database.  The key should not directly reflect the client's name, but should point to a place on your server where you keep the client information.  Then when the client visits your site, you can track the client visits.  The key should be impossible to guess (not a sequential numbering system).

PHP learning resources are available here:
https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html

Or, if you don't want to take the time to learn all of this stuff, you might consider using E-E Gigs to get an experienced PHP / WordPress developer to help you.

One other thought, this is such a common design concept that I would look for a plug-in that already does this sort of thing.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial