Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1059259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:08:38+00:00 2026-05-16T18:08:38+00:00

post.php?replyto=username&othervariable=value For example, if I click a link with this url, then I want

  • 0
post.php?replyto=username&othervariable=value

For example, if I click a link with this url, then I want to take the replyto=username value and insert the value in a textbox using jquery.

function insertParamIntoField(url, param, field) { 
       var anchor = document.createElement('a'), query;
       anchor.value = url;
       query = anchor.query.split('&');

       for(var i = 0, kv; i < query.length; i++) {
          kv = query[i].split('=', 2);
          if (kv[0] == param) {
             field.value = kv[1];
             return;
          }
       }  
    }

    $("a .reply").click(function () {
       insertParamIntoField(this.href, "replyto", $("input .inputField")[0]);
       return false; // prevent default action
    });

this is my html code:

<textarea name="inputField" id="inputField" tabindex="1" rows="2" cols="40"></textarea>
<a class ="reply"  href="home.php?replyto=username">reply</a>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:08:39+00:00Added an answer on May 16, 2026 at 6:08 pm
    function insertParamIntoField(url, param, field) { 
       var anchor = document.createElement('a'), query;
       anchor.href = url;
       query = anchor.search.substring(1, anchor.search.length).split('&');
    
       for(var i = 0, kv; i < query.length; i++) {
          kv = query[i].split('=', 2); console.log(kv);
          if (kv[0] == param) {
             field.value = kv[1];
             return;
          }
       }  
    }
    
    $("a.reply").click(function () {
       insertParamIntoField(this.href, "replyto", $("textarea.inputField")[0]);
       return false; // prevent default action
    });
    

    The insertParamIntoField function will work for any well formed URL (as a string). It works by creating a new anchor DOMElement (but never attaches it to the dom) for that URL and then by using the built in properties of anchor elements (query, hash, etc.) to extract what we want.

    If the URL is from an anchor element, we can create a new version of this function that uses that existing anchor rather than creating a new one:

    function insertParamIntoField(anchor, param, field) { 
       var query = anchor.search.substring(1, anchor.search.length).split('&'); // anchor is a DOMElement 
    
       for(var i = 0, kv; i < query.length; i++) {
          kv = query[i].split('=', 2);
          if (kv[0] == param) {
             field.value = kv[1];
             return;
          }
       }  
    }
    
    $("a.reply").click(function () {
       insertParamIntoField(this, "replyto", $("textarea.inputField")[0]);
       return false; // prevent default action
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say for example: $(.button).click(function() { $.post(commandrunner.php, { param1: 'value', param2: 'value2', param3: 'value3'
I use Jsoup to post a form like: Document doc = Jsoup.connect(http://www.example.com/post.php) .data(titolo, titolo)
I've got this jQuery function: function phpmail(){ $.post('mail.php',{name:$(#name).val()}, function(out){ alert(out); }); } and this
I have a function $.post('php/client.login.php', {username:username, password:password}, function(json){ var ids = json; alert(json.id); },
How to grab all variables in a post (PHP)? I don't want to deal
Okay, so I have my post.php page. If you are not logged in, you'll
I have the code: <div class='selectAnAction'> <ul> <li class='actionSelect'><span>Select an Action</span></li> <li class='action' onclick='location.href=\/post.php?key=.$row['hash'].\;'>post</li>
How can I post a php variable from one file to an other? I
I'm using $().post and php to change the contents of a <textarea>. The script
Today I saw a post on php.net, that I'm quoting here: $Bar = a;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.