Checking Which Button was Clicked

tooshort

New Member
I have a PHP generated form which consists of a list of items, each with a button next to them saying "Remove This" it outputs similar to below:\[code\]Item A - [Remove This]Item B - [Remove This]...\[/code\]I wish to be able to click Remove This and it will detect which item it is, and then remove that from the database. Here's my code so far:selectPlaces.php\[code\]<?phpinclude 'data.php';mysql_connect($host, $user, $pass) or die ("Wrong Information");mysql_select_db($db) or die("Wrong Database");$result = mysql_query("SELECT * FROM reseller_addresses") or die ("Broken Query");while($row = mysql_fetch_array($result)){ $placeName = stripslashes($row['b_name']); $placeCode = stripslashes($row['b_code']); $placeTown = stripslashes($row['b_town']); $outputPlaces .= "<strong>$letter:</strong> $placeName, $placeTown, $placeCode <input type=\"button\" onclick=\"removePlace()\" value=http://stackoverflow.com/"Remove This\" /><br />";}mysql_close();?>\[/code\]Coupled with my admin.php\[code\] <div id="content" style="display:none"> Remove a Place<br><br> <?php include 'selectPlaces.php'; echo $outputPlaces; ?> </div>\[/code\]I know I need to add some javascript to detect which button is clicked but I can't seem to get it working. I tried modifying the onclick="removePlace()" by perhaps passing a variable in the function removePlace(placeID) or something like that, but I'm new to JavaScript and I have no idea how to receive this in the removePlace function.
 
Back
Top