Go to a link by using it's parameters? - html

I have a url and the button doesn't work right so i'm having to input the values into the url. I know it's possible to take the values and put them into the url to get to the page. How is this done? For example
<form method="get" action="https://example.url.com/courses/enrol/manual/manage.php" id="enrolusersbutton-1">
<div>
<input type="submit" value="Enroll users">
<input type="hidden" name="enrolid" value="276">
<input type="hidden" name="id" value="92">
</div>
</form>

Related

To where does a form in an IFRAME POST?

I got this form inside an iframe and want to know where the post actually goes. When I go to the network tab, it only shows the src of the iframe and not where the POST request was sent.
<iframe id="popupOverlay_iframe" name="popupOverlayWindow" src="/cgi-bin/admin/radio_contact.cgi?action=add&member_org_id=46757"></iframe>
The page inside this iframe contains the following:
<form name="add_member" method="post" onsubmit="return submitForm(this);" _lpchecked="1">
<label>
<input type="text" name="email.email" id="email.email" value="" class="init_focus" placeholder="Email:">
</label>
<input type="hidden" name="action" id="action" value="add">
<input type="hidden" name="step" id="step" value="email">
<input type="hidden" name="type" id="type" value="employee">
<input type="hidden" name="member_org_id" id="member_org_id" value="46757">
<input type="submit" name="submit" id="submit" value="Next">
<input type="hidden" name="redirect" id="redirect" value="https://stagemms.nationalmediacalls.com/cgi-bin/admin/radio_detail.cgi?action=show&id=46757">
</form>
On submit, the JavaScript function submitForm is called and its result is returned.
If submitForm and thus the snippet returns false, the form won't be submitted. (The JS might do it's own request.)
If submitForm and thus the snippet returns true, the form will be posted to the current page (/cgi-bin/admin/radio_contact.cgi?action=add&member_org_id=46757) because no action was specified.
In this situation, you should have seen something like this in your network tab:
(/foo.html is url of the outside page, and /foo.cgi?action=add&member_org_id=46757 is the url of the page in the iframe.)

form post action going to wrong URL

I have another personal website I want to post my form to, see code
<form name="requestPrint" action="www.mysite1.com/set_var.cgi"
method="POST">
<input name="value" type="hidden" size="8" value="1">
<input type="hidden" name="page" value="mypage.html"/>
<input type="hidden" name="index" value="94"/>
<input type="submit" value ="Print">
</form>
However when the form posts it goes to www.mysite2.com/www.mysite1.com/set_var.cgi
Is there a way to point it to just www.mysite1.com/set_var.cgi?
You should try the following:
action="http://www.mysite1.com/set_var.cgi"

Passing multiple values in JSP url

I am trying to pass multiple values in a JSP page url to another one.
The code is:
<form name="QuantityForm" onsubmit="return quantityValidation()" action='<%="basket.jsp?addItem="+product.PID%>' method="post">
Quantity <input type="text" name="quantity" size="5">
<input class="button button2" type="submit" value="Add to basket" />
</form>
How do i pass the value of quantity(the field of name="quantity") in the same URL? i know it's something like "Search.jsp?item=<%=search%>&item2=value2&item3=value3.." but i can't seem to structure it properly. Thanks
Do not put your ? and parameters in the action url. Put your parameters in input tags:
<form name="QuantityForm" onsubmit="return quantityValidation()" action='basket.jsp' method="post">
<input type="hidden" name="addItem" value="%product.PID%">
Quantity <input type="text" name="quantity" size="5">
<input class="button button2" type="submit" value="Add to basket" />
</form>
you're using method="post" which doesn't allow parameters to be passed into the url. change it to method="get" if you want the parameters to be passed along with the url.

using an image with my existing submit button

I have this button that executes a php file using ajax, but it needs to use an image that has the path: src="{ROOT_PATH}mchat/form.gif" any help is appreciated thanks!
<form id="myform" method="GET" class="form_statusinput">
<input type="hidden" name="toid" id="toid" value="{mchatrow.MCHAT_USERNAME}">
<div id="button_block">
<input type="submit" id="button" value="Enter">
</div>
</form>
Use an image type input:
<input type="image" src="submit.gif" alt="Submit">
You could insert PHP into the input that like this:
<input type="image" src="<?{ROOT_PATH}?>mchat/form.gif" alt="Submit">

Submitting a hash directly with HTML <form> tag

I need to submit a hash of attributes directly from the form tag. Is this possible?
<form action="/members/1/comments" method="post">
[some element] {"coordinator\_id"=>"1", "time"=>"1230", "info_link"=>"cnn.com"}
<submit>Post</submit>
</form>
This hash should arrive as 'comment' => {"coordinator_id"=>"1", "time"=>"1230", "info_link"=>"cnn.com"}
Almost possible, but not recommended, you should give your values proper names instead, but here is what you asked for:
<form action="/members/1/comments" method="post">
<input name="comment[coordinator_id]" type="hidden" value="1" />
<input name="comment[time]" type="hidden" value="1230" />
<input name="comment[info_link]" type="hidden" value="cnn.com" />
<submit>Post</submit>
</form>