9 Replies - 501 Views - Last Post: 12 March 2009 - 05:52 PM Rate Topic: -----

#1 laces12  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 20-November 08

Post Method

Post icon  Posted 12 March 2009 - 02:42 PM

Hi, is it possible to pass the POST method in a link instead of GET?
Is This A Good Question/Topic? 0
  • +

Replies To: Post Method

#2 roudard  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 143
  • Joined: 26-September 05

Re: Post Method

Posted 12 March 2009 - 02:48 PM

with a hidden form that would submit post when you click the link ?
Was This Post Helpful? 0
  • +
  • -

#3 laces12  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 20-November 08

Re: Post Method

Posted 12 March 2009 - 02:50 PM

View Postroudard, on 12 Mar, 2009 - 01:48 PM, said:

with a hidden form that would submit post when you click the link ?


I can't use a form. I need it to match my css. I tried changing the look, it worked, by formatting the button to look like a link, but the bottom border doesn't extend long enough.
Was This Post Helpful? 0
  • +
  • -

#4 roudard  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 143
  • Joined: 26-September 05

Re: Post Method

Posted 12 March 2009 - 02:54 PM

if you have an hidden form, by essence you don't show it, so your layout should not be affected.
The link can be anything (div, text, img)
[code]
<a href='java script:void(0)' onclick='document.getElementById("myFormId").submit()'>
{link element}
</a>
[code]
Was This Post Helpful? 0
  • +
  • -

#5 laces12  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 20-November 08

Re: Post Method

Posted 12 March 2009 - 02:56 PM

View Postroudard, on 12 Mar, 2009 - 01:54 PM, said:

if you have an hidden form, by essence you don't show it, so your layout should not be affected.
The link can be anything (div, text, img)
<a href='java script:void(0)' onclick='document.getElementById("myFormId").submit()'>
{link element}
</a>




OK, here is my form.
<form action="index.php?do=move" method="post">
<li><input name="north" type="submit" value="Move North" class="submit" /></li>
<li><input name="west" type="submit" value="Move West" class="submit" /></li>
<li><input name="east" type="submit" value="Move East" class="submit" /></li>
<li><input name="south" type="submit" value="Move South" class="submit" /></li>
</form>



Can you show me how to make those links with that method?
Was This Post Helpful? 0
  • +
  • -

#6 roudard  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 143
  • Joined: 26-September 05

Re: Post Method

Posted 12 March 2009 - 03:02 PM

View Postlaces12, on 12 Mar, 2009 - 01:56 PM, said:

View Postroudard, on 12 Mar, 2009 - 01:54 PM, said:

if you have an hidden form, by essence you don't show it, so your layout should not be affected.
The link can be anything (div, text, img)
<a href='java script:void(0)' onclick='document.getElementById("myFormId").submit()'>
{link element}
</a>




OK, here is my form.
<form action="index.php?do=move" method="post">
<li><input name="north" type="submit" value="Move North" class="submit" /></li>
<li><input name="west" type="submit" value="Move West" class="submit" /></li>
<li><input name="east" type="submit" value="Move East" class="submit" /></li>
<li><input name="south" type="submit" value="Move South" class="submit" /></li>
</form>



Can you show me how to make those links with that method?


hmmm, interesting...
i would introduce a direction field ..
<form action="index.php?do=move" method="post">
<input type='hidden' name='direction'>
<li><a href='java script:void(0)' onclick='document.getElementById("myFormId").direction.value="north";document.getElementById("myFormId").submit()'>
Move North</a></li>
//and so on... 
</form>


The get the post value for direction

would that work ?

This post has been edited by roudard: 12 March 2009 - 03:03 PM

Was This Post Helpful? 0
  • +
  • -

#7 laces12  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 20-November 08

Re: Post Method

Posted 12 March 2009 - 03:05 PM

View Postroudard, on 12 Mar, 2009 - 02:02 PM, said:

View Postlaces12, on 12 Mar, 2009 - 01:56 PM, said:

View Postroudard, on 12 Mar, 2009 - 01:54 PM, said:

if you have an hidden form, by essence you don't show it, so your layout should not be affected.
The link can be anything (div, text, img)
<a href='java script:void(0)' onclick='document.getElementById("myFormId").submit()'>
{link element}
</a>




OK, here is my form.
<form action="index.php?do=move" method="post">
<li><input name="north" type="submit" value="Move North" class="submit" /></li>
<li><input name="west" type="submit" value="Move West" class="submit" /></li>
<li><input name="east" type="submit" value="Move East" class="submit" /></li>
<li><input name="south" type="submit" value="Move South" class="submit" /></li>
</form>



Can you show me how to make those links with that method?


hmmm, interesting...
i would introduce a direction field ..
<form action="index.php?do=move" method="post">
<input type='hidden' name='direction'>
<li><a href='java script:void(0)' onclick='document.getElementById("myFormId").direction.value="north";document.getElementById("myFormId").submit()'>
Move North</a></li>
//and so on... 
</form>


The get the post value for direction

would that work ?


The link does nothing
Was This Post Helpful? 0
  • +
  • -

#8 roudard  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 143
  • Joined: 26-September 05

Re: Post Method

Posted 12 March 2009 - 03:10 PM

the link submits the form...

sorry the id='myFormId' attribute should be added to the form flag
you can even wrap it up nicely with a fucntion
function moveSomeWhere(direction) {
	document.getElementById("myFormId").direction.value= direction;
	document.getElementById("myFormId").submit();
}



and then
<form action="index.php?do=move" method="post" id="myFormId">
<input type='hidden' name='direction'>
<li><a href='java script:void(0)' onclick='moveSomeWhere("north")'>
Move North</a></li>
//and so on... 
</form>


This post has been edited by roudard: 12 March 2009 - 03:11 PM

Was This Post Helpful? 0
  • +
  • -

#9 laces12  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 20-November 08

Re: Post Method

Posted 12 March 2009 - 03:25 PM

View Postroudard, on 12 Mar, 2009 - 02:10 PM, said:

the link submits the form...

sorry the id='myFormId' attribute should be added to the form flag
you can even wrap it up nicely with a fucntion
function moveSomeWhere(direction) {
	document.getElementById("myFormId").direction.value= direction;
	document.getElementById("myFormId").submit();
}



and then
<form action="index.php?do=move" method="post" id="myFormId">
<input type='hidden' name='direction'>
<li><a href='java script:void(0)' onclick='moveSomeWhere("north")'>
Move North</a></li>
//and so on... 
</form>



Ok, i made it get method, and i sent me to this:
http://dragonkn.info...direction=south
I need it to be:
http://dragonkn.info...direction=south

This post has been edited by laces12: 12 March 2009 - 03:29 PM

Was This Post Helpful? 0
  • +
  • -

#10 roudard  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 143
  • Joined: 26-September 05

Re: Post Method

Posted 12 March 2009 - 05:52 PM

View Postlaces12, on 12 Mar, 2009 - 02:25 PM, said:

Ok, i made it get method, and i sent me to this:
http://dragonkn.info...direction=south
I need it to be:
http://dragonkn.info...direction=south


i thought you needed it to be sent via post
just add an hidden field with name='do' and value='move'
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1