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

  • Home
  • SEARCH
  • 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 8863117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:53:47+00:00 2026-06-14T15:53:47+00:00

We have html site based on php+mysql. On a page, there is table (4

  • 0

We have html site based on php+mysql. On a page, there is table (4 rows and 1 column) having information about users. Each table cell has user name and appropriate button under it. User names populated to table using SELECT statement.

$q = "select usr.user_id, usr.nickname from users usr";
$r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc));

Then info get’s populated into table

echo "<table border cellpadding=1>"; 
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)){ 
    echo "<tr>";
    echo "<td>" . $row['nickname'] . "</td> <form name ='form_type' method ='GET'><input type = 'button' name = " . $row['user_id'] . " value = 'ButtonValue' id = 'ButtonId'  onclick='processFormData();'></form></td>"; 
}
echo "</table>";

Javascript for getting ButtonName

<script type="text/javascript">
    function processFormData() {
        var name_element = document.getElementById('ButtonId');
        alert(name_element.name);
    }

Alert is using for testing.
My aim is to get user_id value upon button clicked. Currently I’m getting same user_id (firstly found) for all buttons.

  • 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-06-14T15:53:49+00:00Added an answer on June 14, 2026 at 3:53 pm

    Try this:

        echo "<td>" . $row['nickname'] . "</td> <form name ='form_type' method ='GET'><input type = 'button' name = " . $row['user_id'] . " value = 'ButtonValue' id = 'ButtonId'  onclick='processFormData(this);'></form></td>"; 
    

    And this:

    function processFormData(name_element) {
        alert(name_element.name);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple html site.I want to change the language for that based
I have a dynamic php (Yii framework based) site. User has to login to
I have an html file containing <img width=10 height=12 scr=https://www.site.com/yughggcfgh> <img width=11 height=15 scr=https://www.site.com/yughggcfghcvbcvb>
I'm designing an HTML 5 site using a header, article, and footer. I have
In my case, I have an HTML/CSS Menu in the site master . So,
I have sample site: /index.html /appcache.manifest /style.css /test.js index.html: <!DOCTYPE HTML> <html manifest=appcache.manifest> <head>
I have added multiple image upload to my site using HTML api's. I have
From this site: http://www.toymaker.info/Games/html/vertex_shaders.html We have the following code snippet: // transformations provided by
I have a client who has built her entire site using html extensions. As
Okay, so i have the following html added to a site using javascript/greasemonkey. (just

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.