0

Hi, i have a php script form, and i want to use the js confirmation alert, the problem is, this

echo "<script>
var yes=confirm('warever you want');
if (yes){}<---here i want to plase something in php code
else{}
</script>";

$confirm='yes'
how can i math bouth codes?

3
Contributors
2
Replies
5
Views
11 Years
Discussion Span
Last Post by Ithisham
0

JavaScript is a client-side technology and PHP is a server-side technology. This means that the JavaScript code executes on the browser and the PHP code executes on the server. You cannot have server-side code execute based upon the logic executed by the client-side code, at least, not directly.

It would seem that you are wanting to do a check for the functionality of JavaScript. Is this correct? If so, there are many ways to do this, but none of them involve PHP.

0
<script type="text/javascript">
function confirmation()
{
    var yes = confirm("you want to delete record");
    if(yes)
    {
        return ture;
    }
    else
    {
        return false;
    }
}
</script>

note:-

<input type="submit" name="delete" value="delete" onclick="confirmation()" />

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.