The situation is this: On a page written in php, a link is displayed, for example,, and I need that id be automatically substituted on html pages, for example, Those. redirected to another site, but the id is saved from the first link. Help please, I am a complete layman, but I really want to understand how this can be done.

    1 answer 1

    If I understand you correctly, then if you follow the link, then on the side where you go you intercept the GET request with the variable id and its value 46118 and form the link.

    $id = $_GET["id"]; echo "<a href='".$id."'>"; 

    You can also use the php session mechanism if there is a lot of data

    • No, I do not follow the link. It is inserted into the php document from the browser string. The meaning of such a person is registered in the affiliate program and wants to advertise any product for this, I give him my site where in the browser line he adds his partner id to the address of the site. Further it from the browser line is reflected in the php document. In the next step, its id should automatically be substituted to the links on the site pages. In this case, many partners with different id will be able to advertise goods from one site and will not bother with writing sites each for themselves. - Natalia
    • I apologize, everything is somehow blurry in the description. But the meaning remains the same. The id parameter from the address bar should be intercepted by the method I described above - Anovoselof
    • From the address bar, I have already inserted a link into a php document in this way: <? Php @session_start (); if (isset ($ _ GET ["ref_id"]) AND is_numeric ($ _ GET ["ref_id"])) {$ _SESSION ["ref_id"] = $ _GET ["ref_id"]; } if (isset ($ _ SESSION ["ref_id"])) {echo ("Partner ID:". $ _SESSION ["ref_id"]); } else {echo ("Partner is missing."); }?> Next, you need the id to be substituted on all pages of the site where there is a link for registration - natalya
    • I, of course, is not a php expert. But why from you GET is taken with the key ref_id, and not id. And they showed you how to substitute the links - rasmisha
    • The essence of the question lies in how to insert php into html, and not how to insert php from a browser string. My whole site is written in html. - Natalia