Add/Remove Rows Dynamically with drop down list in html table using php

Add/Remove Rows Dynamically with drop down list in html table using php

Here Is My Code. I want to give and get the id of drop down list. Can Anyone Help?

Dropdowndesign.php

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="ddljs1.js">
</script>

</head>

<body>
    <form>
        <table border="1" id="tblSample">
            <tr>
                <th>Name</th>
                <th>Add Field</th>
            </tr>
            <tr>
                <td>
                    <div id="emp">
                    <select id="namesel">
                    <option>Select Name</option>
                          <?php
                          include("db.php");
                            $result=mysql_query("select * from test");
                            while($row=mysql_fetch_assoc($result))
                            {
                                echo "<option>".$row['Name']."</option>";
                            }                       
                        ?>                    
                    </select>
                    </div>
                </td>
                <td><input type="button" value="Add" id="nameselbtn" onclick="javascript:addrow();" /></td>
            </tr>
         </table>
     </form>
</body>
</html>

dropdownjavascript.js

var xmlHttp
xmlHttp=GetXmlHttpObject()

var divid="";
function addrow()
{
    var tbl = document.getElementById('tblSample');
    var lastRow = tbl.rows.length-1;
var iteration = tbl.tBodies[0].rows.length;
    var row =tbl.tBodies[0].insertRow(-1);
var cellRightSel = row.insertCell(0);
    var di1=document.createElement('div');
    di1.id= 'emp' + iteration;
var newCell1 = row.insertCell(1);
    var el1 = document.createElement('input');
    el1.type = 'button';
    el1.value= 'Add';
    el1.id = 'nameselbtn' + iteration;
el1.onclick = addrow;
    newCell1.appendChild(el1);
    cellRightSel.appendChild(di1);
    cellRightSel.appendChild(showEmp(di1.id));

}
function showEmp(str)
{
    if (typeof XMLHttpRequest != "undefined")
        xmlHttp= new XMLHttpRequest();
    else if (window.ActiveXObject)
        xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
    if (xmlHttp==null)
    {
        alert("Browser does not support XMLHTTP Request")
        return;
    } 
    xmlHttp.onreadystatechange = function()
                                        {   
                                            if(xmlHttp.readyState==4)
                                            document.getElementById(str).innerHTML=xmlHttp.responseText   
                                        }
    xmlHttp.open("GET", "ddl_code.php?q="+str, true);
    xmlHttp.send(null);

}

dropdowncode.php

<?php
    $buffer="";
    echo '<select name="emp"><option>Select</option>';
    include('db.php');
    $result=mysql_query("select * from test");
    while($row=mysql_fetch_array($result))
    {
        echo "<option>".$row['Name']."</option>";
    }
    echo "</select>";
?>
View Answers

January 7, 2012 at 3:58 PM

Please visit the following link:

JSP Add Remove row using Javascript


January 17, 2012 at 5:16 PM

so simple..

first display all record in drop down menu.. using php. its easy..

then in second page u just show all the record from the db which is u showing in dropdown menu. in this list display two options Update and Delete. when u click Update it will display record below in text box and update button. and when u click Delete record will be delete.

when u c the dropdonw menu u can c the dynamically changed..

its easy..


January 18, 2012 at 11:06 AM

got it. waiting your reply.....









Related Tutorials/Questions & Answers:
Add/Remove Rows Dynamically with drop down list in html table using php
Add/Remove Rows Dynamically with drop down list in html table using php  Here Is My Code. I want to give and get the id of drop down list. Can Anyone... the following link: JSP Add Remove row using Javascript
how to dynamically add text boxes with add and remove link based on drop down choices, if a particular choice is selected.
how to dynamically add text boxes with add and remove link based on drop down choices, if a particular choice is selected.  how to dynamically add text boxes with add and remove link based on drop down choices, if a particular
Advertisements
how to retreive data dynamically from mysql to drop down list
the data of a particular column in a table into drop down list dynamically...how to retreive data dynamically from mysql to drop down list   sir, i created a table in mysql and i inserted some values into the table through
drop down php mysql - PHP
drop down php mysql  PHP Script required to show the similar drop down item in each menu without refreshing the page. Is it possible if yes how
view data from database using drop down list
view data from database using drop down list  hi i want to view the data from database by selecting a value in a drop down list. for an example drop down list have picture element.when click it select pictures from the database
drop down list in Struts
drop down list in Struts  How to create a drop down list in Struts
How to create a dependent drop down list using [Apache POI]
How to create a dependent drop down list using [Apache POI]  Here I.... In that two drop down list are there. Want to create a drop down list that depends..., and "rice, curd, milk" items will appear in the dependent drop down list in cell
How to create a dependent drop down list using [Apache POI]
How to create a dependent drop down list using [Apache POI]  Here I.... In that two drop down list are there. Want to create a drop down list that depends..., and "rice, curd, milk" items will appear in the dependent drop down list in cell
data should not repeat in the drop down list when it is loading dynamically from database
data should not repeat in the drop down list when it is loading dynamically... the whole department field from the data base (i.e in the drop down list... be included in the drop down list. 1)selDept.jsp: <%@page import
data should not repeat in the drop down list when it is loading dynamically from database
data should not repeat in the drop down list when it is loading dynamically... the data dynamically for database but my problem is in the list the same...); } %> Data base tables are dept CREATE TABLE `dept
Dependent drop down list
dependent drop down list is used my code is successful but when i select class from first drop down list all the data get lossed means the value entered in fields before drop down list get blank.what can i do for this? This is the code
validation for drop down list
validation for drop down list  Hi all I have a form, it contain 12 drop down list. Each drop down has 1 to 5 values,i need to validate this form. the following condition should be true. 1.you can choose only 3 times 5 value. 2
dynamic drop down list
dynamic drop down list  I want to create 2 drop down list, where it takes value from database and the two list are dependent..means if I select a particular value from one the other list is developed accordingly..depending
data should not repeat in the drop down list when it is loading dynamically from database
data should not repeat in the drop down list when it is loading dynamically...); } %> the data tables used for this are dept: CREATE TABLE `dept... TABLE `emp` ( `EMP_NO` int(10
Get values in drop down list
Get values in drop down list  Pls provide me jsp code to get values in drop down list from another table's field. my project has customer... in drop down box in front end..... pls provide me code.. thanx
html menu button drop down
html menu button drop down  How to create a menu button in HTML?   <select id="category"> <option value="1">One</option> <option value="2">Two</option> </select> <select id
Adding checkbox in table using that delete table rows
Adding checkbox in table using that delete table rows  I need coding for how to add checkbox in table,the table data from database.Using that checkbox select more than than one rows,and using delete button i want to delete
Pls provide me jsp code to get values in drop down list from another table's field....
Pls provide me jsp code to get values in drop down list from another table's field....  my project has customer registration and company registration... in customer registration page and should be shown in drop down box in front end
How to pass parameter through drop down list using session management in jsp??
How to pass parameter through drop down list using session management in jsp??  How to pass parameter through drop down list in the URL and access it on same jsp page using session management
Login With Drop Down, Having Departments in different table
the HTML page in such a way the I have a drop down list consisting of Customs... have a drop down list box with Customs and Accounts..A Username and a Password... to login when I select department from the drop down list. Since I cannot populate
Drop Table
; Drop Table in SQL get rid of an object or table from the database. Using a drop Query get rid of all the rows deleted from the table and the structure... into add the records or rows to the  table 'Stu_Table'. SQL statement
Dependant & dynamic drop down list
Dependant & dynamic drop down list  I don't know this should be in this or AJAX forum. I have one dynamic drop down list from data base (working... on the values selected by user in first drop down list. How to achieve this ?   
How to insert multiple drop down list data in single column in sql database using servlet
How to insert multiple drop down list data in single column in sql database using servlet  i want to insert date of birth of user by using separate drop down list box for year,month and day into dateofbirth column in sql server
Drop down list from database
Drop down list from database  Hi, Can I know how do we get the drop down list from database? Eg: select country--select state--select district--so..., we have created two database tables: CREATE TABLE `country
How to access the "Add/Remove Programs" list in Control Panel using Java Program? - Java Beginners
How to access the "Add/Remove Programs" list in Control Panel using Java... innovatively. I've planned to write a java coding for accessing the Add/Remove Programs list in the Control Panel. I don't know, how can i access it? Kindly give me
dynamic drop down list box - Java Beginners
dynamic drop down list box  hi all , I want to dynamically populate a drop down box from an sql query in a servlet program, using only html... servlet comes under server side code. if not using servlet store the all data
Excel Cell Drop Down List
Excel Cell Drop Down List In this section, you will learn how to validate data entered in a cell and provide a drop down list of possible values to the user... in a excel sheet's cell and also can provide drop list of possible value
display table details when selecting table name in drop down liat
display table details when selecting table name in drop down liat  ... database to the dropdownlist in jsp. Example: 1st i want to display the list of tables from the database to the dropdown list... if i select the particular table
store values of drop down list box in database
store values of drop down list box in database  how to store values of drop down list box in oracle database in jsp?I have information inserting form where i have date of birth as drop down list box
Drop-down text selection in jsp/html
Drop-down text selection in jsp/html  Hi, I am trying to create JSP page where I have two drop-downs. There are two-sets of data - First set.... Now the first dropdown will have all the values. The second drop-down depends upon
Select functionality of drop down list - Struts
(in struts application) in which if user select HIDE from the drop down list... have Drop down list having element Test1,Test2,Test3,HIDE and one Text msg box for entering Age,Now if user select "HIDE" from drop-down list the below text
How to import data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase??
the rows dynamically in the excel according to the dataabase??  How to import data from sql server table into an excel file by creating the rows dynamically... 6 columns but the rows keep on increasing in the table time to time. So how
drop down menu
drop down menu  drop down menu using html
Dependant & dynamic drop down list - Follow up
Dependant & dynamic drop down list - Follow up  Thanks for your answer. As per your answer This will select only ONE row (country) from first drop down. In my case user can choose more than one row , which is then sent to next
Retrieve database from the table dynamically in jsp from oracle using servlet
Retrieve database from the table dynamically in jsp from oracle using servlet  Sir, I have created a table in oracle using eclipse, and added few columns dynamically. I want to retrieve the table with all columns dynamically
Display related data in other drop down list on selecting one data in one drop down list
Display related data in other drop down list on selecting one data in one drop down list  How to display related datas in dropdown list from database on selecting one data in previous dropdownlist in Java Server Page
How can we find the number of rows in a result set using PHP?
How can we find the number of rows in a result set using PHP?   How can we find the number of rows in a result set using PHP
How to give value for select in HTML dynamically using javascript
How to give value for select in HTML dynamically using javascript  hi. Consider the situation i am having 2 select options called degree... should be displayed in the dept list. how to do this using javascript
Add values of drop down menu( select option) to mysql table
Add values of drop down menu( select option) to mysql table   Here is my code <?php echo $row['valveName'].'<td>'.$row..." align="bottom" border="2" > </tr> <?php if (isset($_POST
PHP AJAX Dropdown
Ajax Drop-down list: In this current tutorial we will see how to connect a simple drop down menu and mysql table using php and JavaScript (Ajax as whole) and to display the related data on the screen from the table. In this tutorial
creation of drop down menu using ajax in java - Ajax
creation of drop down menu using ajax in java  Hi, Here I want to create a drop down menu using ajax in ofbiz framework. I want to fetch the data from database.I got examples using asp.net and php but I am not getting
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list...)&& ($select!="")){ $select=$_POST['NEW']; } ?> <?php $list
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list...)&& ($select!="")){ $select=$_POST['NEW']; } ?> <?php $list
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list...)&& ($select!="")){ $select=$_POST['NEW']; } ?> <?php $list
retrive the data from access database to drop down list box in jsp
retrive the data from access database to drop down list box in jsp  hai, im new to jsp now im using the jsp along with access database.in table i load all the data's i need to retrive the data from database to dropdown list box
Drop Table
Drop Table       Drop Table in SQL get rid of an object or table from the database. Using a drop Query... The insert into add the records or rows to the  table 'Stu_Table'. SQL statement
drop down list doPost() servlet - Servlet Interview Questions
drop down list doPost() servlet  Can someone assist me HOW to invoke drop down menu list in doPost() servlet? Upon selecting and clicking a submit...(request, response); response.setContentType("text/html
drop down
drop down  how can i add data from choice/dropdown component of java awt to myaql table
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql  can... data into database using an drop down box .....as i m using eclipse as jdbc and postgresql as data base syntax which i m using is like:- java class
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql  can... data into database using an drop down box .....as i m using eclipse as jdbc and postgresql as data base syntax which i m using is like:- java class

Ads