I'm making a script where a user enters a value and clicks Submit. However, I want it to pop up an alert asking if they are sure, if the value is already in the database. I was thinking of doing this with AJAX, but a friend of mine is a jQuery fanatic and told me to go with that instead.
What would be better for this task, and how would I go about doing it in the respective choice? I found a tutorial on Tizag that explained how to do something similar, but they said that a submit button wasn't needed, and thus didn't include anything about it.
EDIT: Some code was requested, here it is:
if (isset($_POST['submit'])){
$sql = "SELECT * FROM table WHERE column='$data'";
$query = mysql_query($sql) or die(mysql_error());
$number = mysql_num_rows($query);
if ($number > 0){
//needs to pop up
//if user selects yes {
//continue
//}else{
//break
//}
}
}
Something along these lines, although I know I need to start the AJAX prior to this code or it will have to reload the page.