Welcome Guest, Not a member yet? Register   Sign In
Sending a form data as GET
#1

[eluser]aryan_[/eluser]
I have a form containing 5 buttons. I want clicking on any button should send it's value in uri.

So if I have 5 buttons

<input type="button" name="b1" value="1" />
<input type="button" name="b2" value="2" />
<input type="button" name="b3" value="3" />
<input type="button" name="b4" value="4" />
<input type="button" name="b5" value="5" />

Clicking on any button should send its value via GET string like

http://example.com/class/function/2

2 is the value of button b2.

How to?

Thanks much!
#2

[eluser]Jondolar[/eluser]
Change your form method
<form method="get">
#3

[eluser]crnalajna[/eluser]
Do the redirect in your controller to any url you want just after submit. Smile
#4

[eluser]Bramme[/eluser]
You could do it with some javascript (I only know jquery though, so here goes)
Code:
$(function() {

$('button').click(function() {

window. location = 'http://example.com/class/function/' + $(this).attr('value');

};

};

remove the space between window. and location, the parser removes it.
#5

[eluser]aryan_[/eluser]
Any generic html solution?
#6

[eluser]Bramme[/eluser]
put all the buttons in a seperate form, make them type="submit" and set the action of the form to the correct link?




Theme © iAndrew 2016 - Forum software by © MyBB