Form with get method no longer posting to action url - html

My form no longer posts to the action url. Here is the html code:
<form method="get" action="/search-results/">
<input type="text" placeholder="Search" name="q">
<input type="submit" value="Search">
</form>
Why isn't the form posting?

This HTML looks correct, so you could have some JavaScript that is preventing the default form submission.

<input type="submit" value="Search">
<input type="submit" name="submit" value="Search">
try this let me know give some code for problem you may past ...

Related

How to submit different forms with same input

Im trying to implement the "i'm feeling lucky" functionality in a quite simple web. The thing is that at first, without this button, the query was properly done (i mean when doing a normal search). But, when i included the im feeling lucky button, the normal search stopped working and know even when you click on norma search it goes directly to the firs result. im new to HTML and still lost regarding forms. Note that i cant do it using js cause its for an assignment meant to be done only with HTML.
Thanks a lot for your help :D
Image
Advanced
<form action="https://www.google.com/search?">
<div><input type="text" name="q" id="search"></div>
<div>
<input type="submit" value="Google Search" id="button">
<form>
<input type="hidden" name="btnI" value="1">
<input type="submit" value="I'm feeling lucky" id="button">
</form>
</div>
</form>
In case that you need two buttons with one text field, perhaps a different approach would be useful. Use
<button type="submit" name="action" value="val1"></button>
and
<button type="submit" name="action" value="val2"></button>
but be careful with this one, since some browsers will upload value from the "value" attribute.
The other method is to use some PHP in your script, like this:
<input type="submit" name="update_button" value="Update" />
<input type="submit" name="delete_button" value="Delete" />
<?php
if (isset($_POST['update_button'])) {
//update button
} else if (isset($_POST['delete_button'])) {
//delete button
} else {
//no button was pressed
}
?>
Happy coding!
You cannot nest forms
You need two forms:
Image
Advanced
<form action="https://www.google.com/search?">
<div><input type="text" name="q" id="search"></div>
<div>
<input type="submit" value="Google Search" id="button">
<input type="hidden" name="btnI" value="1">
</div>
</form>
<form action="https://www.google.com/search?"><input type="hidden" name="q" value="I'm feeling lucky"><button>I'm feeling lucky</button></form>
A few notes:
you have a form tag nested inside the other which is wrong.
you have two submit button with same id.
Remove these issues and it will work as desired.
As I see it, you want to have window inside another window, both of which will have buttons? In that case, don't go form inside form, make it div inside div and in both of them, enter a form, here's and example:
<div id="div1">
<form action="https://www.google.com/search?">
<input type="text" name="q" id="search">
<input type="submit" value="Google Search" id="btn1" class="button">
</form>
<div id="div2">
<form action="https://www.google.com/search?">
<input type="text" name="q2" id="search">
<input type="submit" value="Google Search" id="btn2" class="button">
</form>
</div>
</div>

Angular 5 simple form with Action is not working

The code given below is not working in my angular html file but if i use this code individually in an html file it works i don't know what i am doing wrong this is just a simple form .
<form action='https://easypaystg.easypaisa.com.pk/easypay/Index.jsf' method='post'>
<input name='storeId' value='4950'>
<input name='amount' value='1000'>
<input name='postBackURL' value='https://easypaystg.easypaisa.com.pk/easypay/Confirm.jsf'>
<input name='orderRefNum' value='123113'>
<input name='merchantHashedReq' value='6ohsP8x3PpiaI4oNirWGwjVkyMLP4CbzcH6pZwvu9SViOzx9nLxyR/TtJhwFrxBU686Wf1z22G+TBxuo5QkSscuXp266qQWx8AbGWnLXxG79LHt+5VlD+lH2JkjKO997adwVHH6mGNm8ldtAKkRyf/E92QF5PwhWMjq8i4dlbABIjJxnwPS3x13R/Nbfmlugkz7XpX20DmZ0IhPuGBR95sOpDATIjfW51fuStCVVni4='>
<input name='autoRedirect' value='0'>
<input name='paymentMethod' value='CC_PAYMENT_METHOD'>
<input name='emailAddr' value='johndoe#live.com'>
<input name='mobileNum' value='0123455500'>
<button type="submit" class="btn btn-success" >Submit</button>
<input type='submit' value='asdasd' class="btn">
</form>
You can do it in following way:
<form #form action='https://easypaystg.easypaisa.com.pk/easypay/Index.jsf' method='post'>
...
<button type="submit" class="btn btn-success" (click)="form.submit()">Submit</button>
...
</form>
Use the ngNoForm attribute as documented. This will prevent all "magic" Angular behavior, and you will be able to submit the form in the native way (with page reload).
So something similar to:
<form ngNoForm action='https://easypaystg.easypaisa.com.pk/easypay/Index.jsf' method='post'>
<input name='storeId' value='4950'>
...
<input type='submit' value='asdasd' class="btn">
</form>
Posting a form directly causes a page reload, that's usually not what you want in an Angular application (SPA). Grab the data from the form and send an HTTP request from your code to the server instead.
You should leverage the NgSubmit directive, as described here

Sending an email using HTML form

Here is my code.
<form action="MAILTO:example#gmail.com " method="post" enctype="text/file">
A3 or A4:<br>
<input type="text" name="A3 or A4"><br>
Add image:<br>
<input type="file" name="image"><br>
<input type="button" id=" value="click">
</form>
Issue: After Clicking the submit button or in this case just the button, nothing happens. I am currently using gmail so if you could please help.
First, a button of input type="button" will not prompt the POST action. You should be using a submit button:
<input type="submit" value="click"/>
Second, form action="MAILTO: " should be form action="mailto:someone#example.com".
A simple example perhaps could provide some insights. Yet, as you mentioned Gmail usage, I suggested reading Gmail API Guides in which examples of various languages are provided.
The button should have type="submit"
<form action="mailto:" enctype="text/file" method="post">
A3 or A4:<br>
<input name="A3 or A4" type="text"><br>
Add image:<br>
<input name="image" type="file"><br>
<input type="submit" value="Send">
</form>

How can I make a submit button using html for several form action?

Can I use just a single <input type="submit" value="submit"> but for several form actions ...
Say if I type
<form id="form1" action="action1.py" method="get">
<input type="text" name="name">
</form>
<form id="form2" action="action2.py" method="get">
<input type="text" name="random">
<form>
then I want to use just a single <input type="submit" value="submit" or if there is another way to do it? Can anyone please explain me how to do it?

How to set button's label without changing value in post

I've got this code in html:
<form action="/login/" method="post">
<input type="text" name="login">
<input type="text" name="pass">
<input type="submit" value="login" name="type" >
<input type="submit" value="register" name="type" >
</form>
When I submit this form it sends a get request with the value of the field of the button clicked. However I want to change the label of the button without changing the value sent in get. Is it possible or not?
Use a button element:
<button type="submit" name="type" value="register">Sign up for an account</button>
Note that old IE has problems with this.