Hello everyone

I am developing an application in which , i wrote the code for a pop up confirmation box in javascript, & when it presees ok , i want to call a PHP file from javascript......tried but not working......if anybody can help, would be great......


I have the same problem - please help me out.

How can i call php file in javascript file..?? My pop ups are not working because of this.

Thanks in advance.

Hi There,

I have Made Very Basic Example for you that will help you to understand how to use confirmation Box (confirm() JavaScript) in PHP

here is the code :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP Page</title>
<script type="text/javascript">
function confirmation(url, id) 
	var where_to= confirm("Do you really want Add the Value??");
		if (where_to== true)
			alert("Action Aborted By User!")
<a href="javascript:void(0);" onClick="confirmation('test.php', 'val=Just Testing')" id="links">Link Text</a>
if($_GET['val'] != "")
		echo "this value came From Last Page: ".$_GET['val']; 

I hope this code will help you

Rahul Dev Katarey

Be a part of the DaniWeb community

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