Before redirecting the current page to update or delete page,I have a javascript code to check if any radio button is set or not. If it is, the page is redirected. Otherwise an error message is displayed. But this error message does not work fine all the time Is there any way to display error message dialogue box in php without use of Javascript? Or else what could be corrected in my code below to work fine?
Code: Select all
<?php
session_start();
?>
<html>
<head>
<script type="text/javascript">
function submitAddPage(buttonName, nextPage)
{
var page = nextPage;
var button = buttonName;
if (button == "Add New")
{
document.userform.action = page;
document.userform.submit();
}
}
function submitPage(buttonName, nextPage,countno)
{
var page = nextPage;
var button = buttonName;
var count = countno;
var c=0;
var i=0;
for(i=0;i<count;i++)
{
if (document.userform.id[i].checked)
{
c=1;
break;
}
}
if (c == 1)
{
if (button == "Update")
{
document.userform.action = page;
document.userform.submit();
}
else if (button == "Delete")
{
document.userform.action = page;
document.userform.submit();
}
}
else if (c == 0)
{
alert('Select a user to Update/Delete...Use filter to perform a new search !');
}
}
</script>
</head>
<body>
[b]Php code and form elements[/b]
</body>
</html>