Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Account group</title>
- <link type="text/css" rel="stylesheet" href="css/all.css" />
- <script type="text/javascript" src="js/jquery/jquery-1.2.1.pack.js"></script>
- <script type="text/javascript" src="js/jquery/jquery.populate.js"></script>
- <script type="text/javascript" src="js/populate-page-functions.js"></script>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
- <script type="text/javascript">
- function getValue(a,b)
- {
- document.getElementById("sd1").value=a;
- document.getElementById("sd2").value=b;
- }
- function addRow(id){
- var x = document.getElementById("sd1").value;
- var y = document.getElementById("sd2").value;
- if( ($('#'+x).text()==''?0:1)==1)
- {
- $('#'+x).text(y);
- }
- else{
- var tbody = document.getElementById(id).getElementsByTagName("tbody")[0];
- var row = document.createElement("tr");
- var data1 = document.createElement("td");
- data1.appendChild(document.createTextNode($('#sd1').val()));
- var data2 = document.createElement("td");
- data2.appendChild(document.createTextNode($('#sd2').val()));
- row.appendChild(data1);
- row.appendChild(data2);
- tbody.appendChild(row);
- }
- }
- </script>
- <script src="js/ajaxsbmt.js" type="text/javascript"></script>
- </head>
- <body>
- <table width="500" border="0" bordercolor="#000000">
- <tr height="10" bgcolor="#CCFFFF">
- <th align="left" valign="top" width="50%"><form name="MyForm" method="post" onsubmit="return false;"> <input type="text" name="s" id="sd1" required>
- <input type="text" name="sd" id="sd2" required>
- <input name="send_button" type="submit" value="Send" onclick="javascript:addRow('dataTable')" /></form></th>
- <th align="left" valign="top" width="50%" ><?php
- $con = mysql_connect("localhost","root","");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("account", $con);
- $result = mysql_query("SELECT * FROM accountgroup");
- ?>
- <div style="height: 300px; overflow:auto; overflow-y:auto; ">
- <table width="100%" border="0" bordercolor="#000000" id="dataTable">
- <tbody>
- <tr height="10" bgcolor="#CCFFFF">
- <th align="left" valign="top" bgcolor="#0000FF">Group Code</th>
- <th align="left" valign="top" bgcolor="#0000FF">Group Name</th>
- </tr>
- <?php
- $num=mysql_numrows($result);
- $i=0;
- while ($i < $num) {
- $f1=mysql_result($result,$i,"GroupID");
- $f2=mysql_result($result,$i,"GroupName");
- ?>
- <tr bgcolor="#CCFFFF" onDblClick="getValue('<?php echo $f1; ?>','<?php echo $f2; ?>')">
- <td valign="top" bgcolor="#99FFFF" ><?php echo $f1; ?></td>
- <td valign="top" bgcolor="#99FFFF" id='<?php echo $f1;?>'><?php echo $f2; ?></td>
- </tr>
- <?php
- $i++;
- }
- ?>
- </tbody></table></div></th>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement