<input type="button" name="b2" value="Delete" onClick="<? $delQuery = 'DELETE FROM artist_schedule WHERE artist_schedule_id=.$artistID'; $result=mssql_query($delQuery,$con); ?>"/>
when i echo $artistID i get the value.
how do i delete using a javascript button onClick ??
if using function also then how do i implement the function ?

You need to create a parametrized function with $artistID as the input.

Then call the function from your application code.

Thank goodness javascript can't access your database directly.

As the previous poster stated, you need to do this in server side script and then call it from your page. In this case, it would be an AJAX call.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.