post get without forms
Moderator: General Moderators
post get without forms
Is it posible for a link (not a form) to use method POST.
<a href="link.php" method="POST">link</a>
I wish to moderate user comments, with something that looks like:
Fred: I like the pictures! moderate 0 1 2 3 4 5
<a href="moderate.php?ID=1234&moderate=4" method="POST"> 4</a>[/b]
I can currently only do this with a form. But forms can only use Buttons or Images as the action not a link.
Any thoughts?
<a href="link.php" method="POST">link</a>
I wish to moderate user comments, with something that looks like:
Fred: I like the pictures! moderate 0 1 2 3 4 5
<a href="moderate.php?ID=1234&moderate=4" method="POST"> 4</a>[/b]
I can currently only do this with a form. But forms can only use Buttons or Images as the action not a link.
Any thoughts?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Links always use GET, as far as I know.
I wonder if it's possible to do it in JavaScript. Maybe something like:
But probably not.
I wonder if it's possible to do it in JavaScript. Maybe something like:
Code: Select all
<a href="..." onClick="post_form()">- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
if you really don't want to use forms as widgets you still may use them as hidden 'transport-objects'
Make forms with type="hidden"-elements only and let onClick-JavaScripts submit them.
I would 'group' the form and the onClick-Element within a <div> or <span> to identify the form. Something like^__ not tested at all 
(if you try this please let me know if it works or not)
Make forms with type="hidden"-elements only and let onClick-JavaScripts submit them.
I would 'group' the form and the onClick-Element within a <div> or <span> to identify the form. Something like
Code: Select all
<div><form method="post">....</form>
<a href="JavaScript:void(0)"; onClick="this.parentElement.childrenї0].submit();">....
</a></div>(if you try this please let me know if it works or not)
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
This may be of interest to some people:
http://www.evolt.org/article/Forms_and_ ... index.html
How you do this sort of thing really depends on what you think of accessiblity.
Mac
http://www.evolt.org/article/Forms_and_ ... index.html
How you do this sort of thing really depends on what you think of accessiblity.
Mac
try this:
i think it'll work for you 
Code: Select all
<?php echo "Value is: $moderate"; ?>
<script language="javascript">
<!--
function getModerate(whichone) {
document.moderate_form.moderate.value = whichone
moderate_form.submit();
}
</script>
<form name="moderate_form" method="POST" action="testing.php">
<input type="hidden" name="moderate" value="1">
<table><tr><td>
<a href='javascript:getModerate(1)'>1</a>
<a href='javascript:getModerate(2)'>2</a>
<a href='javascript:getModerate(3)'>3</a>
<a href='javascript:getModerate(4)'>4</a>
<a href='javascript:getModerate(5)'>5</a>
</td></tr></table>
</form>Thanks fatalcure !
Perfect! Just what I was looking for!
But I guess I should use the new non global method 
Perfect! Just what I was looking for!
Code: Select all
echo 'Value is:'. $_POSTї'moderate'];