skip to Main Content

lets say I have the link http://localhost:8080/Simple/index.php?ref=user5 after I click it, I want “user5” to show up inside Input.

Thank you in advance

2

Answers


  1. You must use $_GET variable to access URL variable.

    here is a simple solution:

    <input type='text' name='foe' id='bar' value='<?php echo $_GET['ref']; ?>' />
    
    Login or Signup to reply.
  2. You can use php inbuilt GET method which helps to get or collect query string parameters from URL.
    http://localhost:8080/Simple/index.php?ref=user5

    Once you click this URL then get query string parameters through $_GET, because $_GET is an associative array so you can achieve user5 by $_GET[‘ref’].

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search