alena1347 Posted January 29, 2013 Share Posted January 29, 2013 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>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/273771-calling-a-javascript-function-from-php/ Share on other sites More sharing options...
trq Posted January 29, 2013 Share Posted January 29, 2013 Events execute on the browser, while PHP executes on the server. Quote Link to comment https://forums.phpfreaks.com/topic/273771-calling-a-javascript-function-from-php/#findComment-1408882 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.