简体   繁体   中英

How to Get URL Parameters And Use In 'iframe'?

I need to get URL parameters and use in Iframe :

URL example: www.example.com?id=123&user=XXX

So, my page have parameters in URL and i need to get those (ex: 123, XXX)

and use in iframe (you can see below src link with parameters).

<iframe id="JotFormIFrame-9262" style="width: 1px; min-width: 100%; height: 539px; border: none;" title="Custom Webview" src="https://form.com?i=123&u=XXX" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen">

i've tried some php code like to capture URL parameters with

<form action="example.com" method="get">
      <input type="hidden" value="<?php echo $id;?>" name="id">
      <input type="hidden" value="<?php echo $user;?>" name="user">
    </form>

and php to use them

<?php $id = $_GET['id'];?>

But didn't work

As far I have understood, what you can do is first you can get the parameters using $_GET and then store them in variable.

$id = $_GET['id'];
$user = $_GET['user'];

And then pass them in iFrame URL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM