Jump to content


Calling a javascript function from php

php form java script function

  • Please log in to reply
1 reply to this topic

#1 alena1347


    Advanced Member

  • Members
  • PipPipPip
  • 44 posts

Posted 29 January 2013 - 04:46 AM

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


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>";
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>";

#2 trq


    Advanced Member

  • Administrators
  • 31,039 posts
  • LocationSydney, Australia.

Posted 29 January 2013 - 05:44 AM

Events execute on the browser, while PHP executes on the server.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users