<iframe align="middle" src="http://www.example.com?id=5555555" width="100%" height="300">
</iframe>
How can I pass this id value to example.com. Suppose I put this iframe to any webpage and when the iframe loads with the webpage I want to get the value id = 5555555 in example.com.
How to do this, I have tried to google a lot but couldn’t get a definite answer.
Thanks in advance.
You’ll need to use the PHP superglobal $_GET. in your script, the basic implementation is very simple:
However, you will want to check the value before you do anything with it, because any user can type into their browser URL bar and change that id value.
If you’re going to save it in a database, make sure you escape the value and even better, use a stored procedure. Scrub it however you can – check the length, the value, anything that can be used to throw off your code. Failure to do so can result in anything from a silly looking output on a page to a compromised server.