how to get the Get variables from a link clicked in an email


How do i get the get variables from a link clicked in an email?

I've seen parse_str but i dont know how to make sure the data is safe

do i use html_special_chars or strip_tags or preg_replace.i I was thinking something like this...assuming here just one variable $data

$data = strip_tags($data');
$data = preg_replace('/on[a-z]+=\".*\"/i', '', $data);

Thank you
Who is Participating?
GaryConnect With a Mentor Commented:
Use strip_tags

    $email = strip_tags($_GET['email]);

I didnt know what to do wht the @ and - and _ and chracters
You don't do anything, they are valid in email adresses
Example link?
If it's just standard querystring name pairs then

    $name = $_GET['name'];
Dave BaldwinFixer of ProblemsCommented:
It is no different than a link with a query string in a web page.  You use the $_GET variables to retrieve them.  This page shows simplified ways of handling them:   There is also a page there about handling email variables and checking them.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

andiejeAuthor Commented:
How do i make them safe? I want one of the get variables to be an email. thanks
Safe to do what?
andiejeAuthor Commented:
safe to store in datbase and then echo to string

I want all javascript tags removing and to be on the safe side all html takgs too for now please

I didnt know what to do wht the @ and - and _ and chracters like that in an email address

Dave BaldwinFixer of ProblemsCommented:
I agree with Gary.  I have hundreds of forms out there that have email addresses as inputs.  You must accept those characters in an email because they are valid parts of an email.  This page shows what characters are valid in an email address.
andiejeAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.