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 4039286
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:35:20+00:00 2026-05-20T12:35:20+00:00

Im trying to pass some values into a text box from a child page

  • 0

Im trying to pass some values into a text box from a child page to the parent page. The code I have works fine passing one integer value through to the parent page, however it won’t pass a string. I also want to try and pass another value through to an additional text box, how would I go about doing that?

logRequestAdmin is the name of the form on the parent page, and ClientName is the text box to post the first value to.

Here’s my code for the child page:

<head>
<script type="text/javascript">
    <!-- Begin
    function moveData(info) {
    window.opener.document.logRequestAdmin.ClientName.value = info;
    self.close();
    return false;
    }
    // End -->
</script>

        <table>
            <tr>
                <td class="clientTop">Client ID</td>


                <td class="clientTop">Client Name</td>

                <td class="clientTop">Username</td>

                <td class="clientTop">Email</td>

            </tr>


            $query = "Select * from clients"; 

            $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());  

            while($row = mysql_fetch_array($result))
            {

                $ClientID = $row['ClientID'];

                $ClientName = $row['ClientName'];

                $Username = $row['Username'];

                $Email = $row['Email'];

                echo '<tr>
                        <td class="clientBottom"><a href="javascript:void();" onclick="moveData(' . $ClientID . ');">' . $ClientID . '</a></td>
                        <td class="clientBottom"><a href="javascript:void();" onclick="moveData(' . $ClientID . ');">' . $ClientName . '</a></td>
                        <td class="clientBottom"><a href="javascript:void();" onclick="moveData(' . $ClientID . ');">' . $Username . '</a></td>
                        <td class="clientBottom"><a href="javascript:void();" onclick="moveData(' . $ClientID . ');">' . $Email . '</a></td>
                      </tr>';       
            }
        </table>
  • 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-20T12:35:21+00:00Added an answer on May 20, 2026 at 12:35 pm

    It looks like the problem is in your javascript function call in the A tags. Here is how your code works if you pass integers and strings…

    echo '...
              <td class="clientBottom"><a href="javascript:void();" onclick="moveData(' . $ClientID . ');">' . $ClientID . '</a></td>
              <td class="clientBottom"><a href="javascript:void();" onclick="moveData(' . $ClientName . ');">' . $ClientName . '</a></td>
          ...';
    

    The above lines write HTML like:

    <td class="clientBottom"><a href="javascript:void();" onclick="moveData(1);">1</a></td>
    <td class="clientBottom"><a href="javascript:void();" onclick="moveData(The Dude);">The Dude</a></td>
    

    JavaScript thinks you’re passing a 1 the first time, and should throw an error on The Dude since the function call is malformed.

    If you add some extra apostrophes, it should work just fine.

    PHP:

    echo '...
              <td class="clientBottom"><a href="javascript:moveData(\'' . $ClientID . '\');">' . $ClientID . '</a></td>
              <td class="clientBottom"><a href="javascript:moveData(\'' . $ClientName . '\');">' . $ClientName . '</a></td>
          ...';
    

    HTML:

    <td class="clientBottom"><a href="javascript:moveData('1');">1</a></td>
    <td class="clientBottom"><a href="javascript:moveData('The Dude');">The Dude</a></td>
    

    If you want your rows to look cleaner, you could also alter your js function to pass the innerHTML property of the link tag…

    <script type="text/javascript">
        function moveData(el) {
            info = el.innerHTML;
            // do something with info...
        }
    </script>
    ...
    <a href="javascript:void();" onclick="moveData(this);">Lorem Ipsum</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to pass some values into an imagebutton click event, something like this: <asp:ImageButton
I am trying to pass some JavaScript variables that I have assigned to form
I am trying to pass some Subsonic collections to a client via a web
I'm trying to pass in a Base64 string into a C#.Net web application via
I'm trying to pass one method to another in elisp, and then have that
I'm trying to pass a null value for the first parameter in the code
I have an array: myarr = []; I'm filling it with some values: myarray['name']
I'm trying to build a safe user authentication system. The code is from http://net.tutsplus.com/tutorials/php/simple-techniques-to-lock-down-your-website/
Currently I'm trying to parse some html and return an array with the values
I am trying to make Task parcelable to put into an bundle to pass

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.