Results 1 to 2 of 2

Thread: Append user input to predefined partial URL

  1. #1
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Append user input to predefined partial URL

    I am sure the code I am looking for is here somewhere, but I am not sure if my terminology in searching for it is correct. I would guess it is rather simple to code, but I am very new to scripting and am just doing this for a gaming group I belong to.

    What I am needing is for user input (user ID#) to be added to a preset URL to complete the URL.

    Say the input is 1234567890 I would like for the following to appear in 4 separate copyable text fields:
    http://www.url1.com/xyz.php?from=1234567890
    http://www.url2.com/xyz.php?from=1234567890
    http://www.url3.com/xyz.php?from=1234567890
    http://www.url4.com/xyz.php?from=1234567890abc1234567890(twice in this URL)

    A copy to clipboard next to each would be great, or the URL being clickable would be wonderful.

    Also wanted, but not needed, is if instead of the user ID being used, if it could grab it from an original URL input, such as:
    http://www.2bedeleted.com/profile.php?id=1234567890&ref=name and just grab the 1234567890.

    Could someone help a gal out?

  2. #2
    Join Date
    Nov 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    PHP sessions would do the trick.

    Code:
    <?php 
    
    $id = $_GET['id'];  //sanitize this value before using it!
    $ref= $_GET['ref'];  //sanitize this value before using it!
    
    echo "$id is id and $ref is ref";
    ?>
    Hope that helps.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •