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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:13:27+00:00 2026-06-17T23:13:27+00:00

hi i am trying to generate a table row on a button click butmy

  • 0

hi i am trying to generate a table row on a button click butmy problem is with combox it loads data from mysql database can anyone help on how could i use javascript with mysql
here is my javascript code

<script language="javascript" type="text/javascript">
                        var i=1;
                        function addalRow()
                        {
                            var tbl = document.getElementById('alimtable');
                            var lastRow = tbl.rows.length;
                            var iteration = lastRow - 1;
                            var row = tbl.insertRow(lastRow);

                            var firstCell = row.insertCell(0);
                            var el = document.createElement('input');
                            el.type = 'text';
                            el.name = 'alimname_' + i;
                            el.id = 'alimname_' + i;
                            el.size = 40;
                            el.maxlength = 40;
                            firstCell.appendChild(el);

                            var secondCell = row.insertCell(1);
                            var el2 = document.createElement('input');
                            el2.type = 'text';
                            el2.name = 'alimmob_' + i;
                            el2.id = 'alimmob_' + i;
                            el2.size = 13;
                            el2.maxlength = 13;
                            secondCell.appendChild(el2);


                            var thirdCell = row.insertCell(2);
                            var e13 = document.getElementsByName('qabil')[0]; 
                            e13.setAttribute('name',e13.getAttribute('name')+'_'+                 
                                   i);//change the select's name 
                            thirdCell.appendChild(e13);

                            // alert(i);
                            i++;
                            makhtab.r.value=i;
                            //  alert(i);
                        }
                    </script>

here is my table code

<table border="1px" id="alimtable" size="100px" cellspacing="0" cellpadding="2">
<tr>
<td><strong>Muallim Name</strong></td>
<td><strong>Mobile</strong> </td>
<td><strong>Qabiliyat</strong> </td>
</tr>
<tr>
<td><input name="alimame_0" type="text" id="zimname_0" size="40" maxlength="20" /></td>
<td><input name="alimmob_0" type="text" id="zimmob_0" size="13" maxlength="20" /></td>
<td><select id="qabil" name="qabil" class="element text large" style="font-size:14px;"/>
<option value=""></option>
<?php
$result = mysql_query("SELECT code, `name` from qabiliyat ") or die(mysql_error());
 while ($qab = mysql_fetch_array($result)) {
echo "<option value='$qab[code]'>$qab[name]</option>";
 }
?>
</select></td>
</tr>
</table>
<input type="button" value="Add" onclick="addalRow();" /><input name="h" type="hidden"  id="r" value="1" />
  • 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-17T23:13:28+00:00Added an answer on June 17, 2026 at 11:13 pm
    $("#addBox").click(function () {
    var newDD = $("<select/>");
    $(newDD).append("<option>Option 1</option>");
    $(newDD).append("<option>Option 2</option>");
    $("#myBox").append(newDD);
    });
    
    <div id="myBox"></div>
    <input type="button" id="addBox" value="Add" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to generate an insert statement from a row in a table?
I'm trying to generate a table of contents from a block of HTML (not
I'm trying to generate a big table of consecutive numbers in MySQL. I just
I am trying to generate a query that selects all from a user table
I am trying to clone a table row and generate an array with id
I have a table I am trying to generate reports from. Its basically a
I'm trying to create an html table from database records. I want the table
I generate a Table from a database to look like this <table id=items> <thead>
In PHP I am having difficulty trying to extract row data from one SQL
I'm trying to generate a dynamic table using CSS: <html> <head> <style> div.el1, div.el2

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.