0

I would like to pass values in anchoring.
Keeping it visible I can use <a href=xyz.php?ID=123&action=delete>

In above I would like action=delete to be hidden. What to do?

I cannot use input type=hidden as I'm not submitting the form.instead requires onclick by clicking on reference page in anchoring and passing the hidden values in URL.

Can't I use <a href="xyz.php?ID=123&<?php <input type=hidden name='action' value='delete'>">

5
Contributors
5
Replies
7
Views
5 Years
Discussion Span
Last Post by ko ko
1

following is the sample,
you can have 2 forms and onclick you can use javascript fuction to post your values to xyz.php.

<script lang='javascript'>
function delete_record(id,act)
{
   
   document.getElementById('ID').value=id;
   document.getElementById('action').value=act;
   document.actionform.submit();
}
<script>
<form name='actionform' id='actionform' action='xyz.php' method='post'>
<input type='hidden' name='ID' id='ID'>
<input type='hidden' name='action' id='action'>
</form>
</form>

<form name='mainform' id=mainform action='somepage.php'  method='post'>
rec 1<a onclick="javascript:delete_record(123,'delete');">Delete</a><br>
rec 2<a onclick="javascript:delete_record(124,'delete');">Delete</a><br>
rec 3<a onclick="javascript:delete_record(125,'delete');">Delete</a><br>
</form>

Edited by urtrivedi: n/a

Votes + Comments
Useful post
0

Then I used the same method fr action=edit.

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

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

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

  </form> 

It doent submit the** action=edit**. Where am I wrong?

Edited by Nick Evan: Fixed formatting

0

You're using POST method, not GET. How you receive that "action" $_GET will not get any value from the form. It should be $_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.