I used the method for action=edit to pass the value in hidden way to required page.

function editRecord(val)
{
document.getElementById("action")=val;
document.actionEdit.submit();
}

<table>
<tr>
<td><a href='abc.php?cno=<?php echo $data[$i]["no"]; ?>' onclick='return editRecord("edit")' > Number </a> </td>
</tr>
</table>


<form name="actionEdit" id="actionEdit" action="./abc.php?page=xyz" method="post">

<input type="hidden" name="action" id="action" />

</form>

It doesn't submit the action=edit. Where am I wrong?

getElementById returns an object. You cannot set a value to it. Try this:

var element = document.getElementById('action');
element.setAttribute('value', val);
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.