Search the Community
Showing results for tags 'java script'.
-
I need to call a javascript or a php function from a form made in php, so that I could make change in data base on clicks. 1)I included the function on onclick event on submit but nothing happens. 2)The file name in which this code is include is view_users.php could someone hel me solve this <?php mysql_select_db("programmers") or die(mysql_error()); $data = mysql_query("SELECT * FROM user_allotment") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { echo "<tr>"; echo "<td>".$info['id'] . "</td>"; echo "<td>".$info['uname'] . "</td> "; echo "<td>".$info['password'] . "</td>"; $id=$info['id']; echo "<form method="post" action="view_users.php">"; echo "<td><label><input type="button" name=/"$id/" value="edit" align="middle" onclick="edit()"/></label></td>"; echo "<td><label><input type="button" name=/"$id/" value="delete" align="middle" onclick="edit()"/></label></td>"; echo "<td><label><input type="checkbox" name=/"$id/" value="privilege" align="middle" onclick="edit()"/></label></td>"; echo "</form>"; echo "</tr>"; } ?>
-
Hi. I have here my Javascript code that adds dynamic textbox (row) my problem is how can I save this to database using PHP script? How you can help me guys.. Thanks! <script type="text/Javascript"> function addRow®{ var root = r.parentNode;//the root var allRows = root.getElementsByTagName('tr');//the rows' collection var cRow = allRows[0].cloneNode(true)//the clone of the 1st row var cInp = cRow.getElementsByTagName('input');//the inputs' collection of the 1st row for(var i=0;i<cInp.length;i++){//changes the inputs' names (indexes the names) cInp.setAttribute('name',cInp.getAttribute('name')+'_'+(allRows.length+1)) } root.appendChild(cRow); } function shownames(){ var allInp=document.getElementsByTagName('input'); for(var i=0;i<allInp.length;i++){ alert(allInp.name) } } </script> My HTML code: <form method= POST> <table width="1024" border="0" cellspacing="6" cellpadding="0"> <tr> <td width="195"><div class="user"><input type="text" name="textfield_a" id="user" tabindex="6"/></div></td> <td width="410"><div class="reported"><input type="text" name="textfield_b" id="reported" tabindex="7"/></div></td> <td width="399"><div class="reported"><input type="text" name="textfield_c" id="reported" tabindex="8"/></div></td> <td width="10"><input name="button" type="button" value="+" onclick="addRow(this.parentNode.parentNode)"></td> </tr> </table> </form>
- 5 replies
-
- php
- java script
-
(and 1 more)
Tagged with: