Page 1 of 1

want to insert data into table on cliking a form button

Posted: Tue Apr 20, 2004 2:32 am
by bugthefixer
i hav a table named 01_detail and on clicking add button i want to insert data into table ..my code is like this<input type="button" name="add" value="add" onClick="<?php
mysql_query("insert into 01_detail values(03,22,'00:00:00','00:00:00')");
?>">
when i run this query in mysql prompt it works fine but it doesnt work on cliking add button..anybody can tell me y..

Posted: Tue Apr 20, 2004 3:07 am
by JayBird
First of all, may i suggest you read this!! - viewtopic.php?t=21171

Secondly, the code yu have written is total nonsense. You can't run PHP using a Javascript function.

You will need to submit the page, then run the query. Remember, PHP is server side, NOT client side!

Mark