getting the value of anchor tag

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
athlhaz
Forum Newbie
Posts: 9
Joined: Fri Dec 23, 2011 12:00 am

getting the value of anchor tag

Post by athlhaz »

hi i have a php code that deleting notification in the database i use this function

Code: Select all

jQuery(function ($) {
	$('#confirm-dialog input.confirm, #confirm-dialog a.confirm').click(function (e) {
		e.preventDefault();

		// example of calling the confirm function
		// you must use a callback function to perform the "yes" action
		confirm("Are you sure you want to delete this notification?", function () {
			window.location.href = $("a.confirm").attr("href");
		});
	});
});

function confirm(message, callback) {
	$('#confirm').modal({
		closeHTML: "<a href='#' title='Close' class='modal-close'>x</a>",
		position: ["20%",],
		overlayId: 'confirm-overlay',
		containerId: 'confirm-container', 
		onShow: function (dialog) {
			var modal = this;

			$('.message', dialog.data[0]).append(message);

			// if the user clicks "yes"
			$('.yes', dialog.data[0]).click(function () {
				// call the callback
				if ($.isFunction(callback)) {
					callback.apply();
				}
				// close the dialog
				modal.close(); // or $.modal.close();
			});
		}
	});
}
and here's my code for viewing the records in the database

Code: Select all

<?php session_start();
               include('../Connection/mysql_connect_notification.php');
               
               $query="SELECT * FROM tb_notification WHERE Employee_No = '$_SESSION[u_name]' ORDER BY ID_No DESC";
               $result=mysql_query($query);
               
               while($row=mysql_fetch_array($result)) { 
                    echo "<b>$row[3] $row[4]</b> <br/> $row[2]<br/>
                    <div id='content' style='background-color: white;'>
                    <div id='confirm-dialog'>
                    <a class='confirm' style='margin-left: 145px;' href='?delete=$row[0]' id='<?php echo $row[0]'>Delete</a><hr>";    
                    echo "</div>";
               }
?>
the question is i want to get the value of the link that i click and output it to the url using the $_GET.. the problem is i always get the last value.
Post Reply