I want visitors to my website to be able to search for airport lounges offered by a company called Priority Pass. I have created the following form:
<form action="http://prioritypass.com/lounges/lounge-print.cfm" method="post">
<input type="text" id="print_airport_code" name="print_airport_code" value="MAN" />
<input type="submit" value="Submit" />
</form>
Which mirrors the form they have on their own mobile search site (here). But when I submit my form it doesnt seem like the parameters are being posted properly.
Any help would be great. Thanks.
The form on their website doesnt appear to contain any fields which I have missed?
You're pointing to the wrong URL; POSTing to /lounges/lounge-print.cfm is producing an HTTP redirect header, which is corrupting your output.
Additionally, the name of your input field is incorrect. Using someone else's form results often requires you to maintain all field names consistently as they appear on the remote site.
Change the form to:
<form action="http://www.prioritypass.com/mobile/lounges.cfm" method="post">
<input id="Airport_Code" name="Airport_Code" type="text" size="10" value="MAN" />
<input type="submit" value="Submit" />
</form>
Related
I am trying to create a search box on my site. However when someone clicks "search" or presses "enter/return". I want a separate tab to open with the search results from a different site to be displayed.
Example:
My site: www.example.com
# using another answer on stackoverflow
# I have tried a lot of different action urls.
# the website url to which I want to send the search:
<form method="get" action="website.com/?searchTerm">
<input type="text" name="searchTerm"/>
</form>
When I try to demo it using the above and press enter, I simply go to the website i.e. website.com/?searchTerm not the results page.
Another approach I thought might work is to replace the searchTerm in the url of the results page of the website when Enter or button is clicked on www.example.com using a tags.
You can use the target attribute on the form tag.
Don’t forget to inform your users, including screen reader users, that the action will open a new tab.
If you use the GET method, input names and values are going to be passed as query parameters. So <input name="searchTerm" value="test"> will become ?searchTerm=test in the requested URL.
get: The GET method; form data appended to the action URL with a ? separator. Use this method when the form has no side-effects.
<form method="get" target="_blank" action="https://example.com/SearchDisplay">
<label>Search Term
<input type="search" name="searchTerm">
</label>
<button type="submit">Search (opens in new tab)</button>
</form>
The above code would not work in an interactive stack snippet, because it would be inside an iframe.
For your search to actually work with the target site
If you inspect the search form on your target website, you’ll notice they use SearchDisplay as the action. Additionally, they include a bunch of hidden fields in their form. You will need to figure out which ones to include in your form as well, for your query to not get blocked.
Beware, though, that this are implementation details of the target shop, not a stable search API like OpenSearch. So it might change at any time, and your search form will no longer work.
The form code from the target website:
<form accept-charset="UTF-8" name="CatalogSearchForm" action="SearchDisplay" method="get" id="searchForm" class="searchForm">
<div class="search-input-wrapper" role="group" aria-label="...">
<div class="search-input-field">
<input type="hidden" name="storeId" value="5451206" id="WC_CachedHeaderDisplay_FormInput_storeId_In_CatalogSearchForm_1">
<input type="hidden" name="catalogId" value="10002" id="WC_CachedHeaderDisplay_FormInput_catalogId_In_CatalogSearchForm_1">
<input type="hidden" name="langId" value="-3" id="WC_CachedHeaderDisplay_FormInput_langId_In_CatalogSearchForm_1">
<input type="hidden" name="pageSize" value="10" id="WC_CachedHeaderDisplay_FormInput_pageSize_In_CatalogSearchForm_1">
<input type="hidden" name="beginIndex" value="0" id="WC_CachedHeaderDisplay_FormInput_beginIndex_In_CatalogSearchForm_1">
<input type="hidden" name="sType" value="SimpleSearch" id="WC_CachedHeaderDisplay_FormInput_sType_In_CatalogSearchForm_1">
…
I'm trying to make a form for a web design class. The form action HAS to be a mailto. The form also needs a hidden field that pops up after I hit the submit button. Everything looks nice so far, but after I upload my file to the school server, nothing happens after I click the submit button. I'm not to sure what's causing the problem. Here's my code:
<form action="mailto:email#example.com" method="GET" enctype="text/plain">
<fieldset>
<legend><strong>Vote Your Favorite Month(s)!</strong></legend> <br/>
<input type="checkbox" name="votemonth" value="Jan"> January |
<input type="checkbox" name="votemonth" value="Feb"> February |
<input type="checkbox" name="votemonth" value="Mar"> March <br/><br/>
<input type="hidden" name="success-link" value="thankyou.html">
<p><input type="submit" value="Submit"> <input type="reset" value="Restart"></p>
</fieldset>
</form>
I have the thankyou.html file in the same location of this file. I've tried changing up email addresses, using POST, taking out the enctype, changing the location of the hidden input type, but none of that changed anything.
Hidden fields work just like any other field.
The basic problem is that mailto: as a form action does not work well enough to use on the WWW. It only works if the visitor has an unlikely combination of compatible browser and default email client.
If you have that combination of software, then the data in the field will be included in the generated email.
Submitting a mailto: form will not cause the browser to load a new HTML document.
I am using a form id= contact-form with a form loader. I have tried getting my email to submit with form action and html href however nothing has working this is what I am currently trying to get to work. any suggestions?
<form method="post" action="mailto:m_galvin1005#email.campbell.edu" >
<input type="submit" value="Send Email" />
</form>
I placed this form method inside of a form id. Not sure if thats where I am getting held up at
Unfortunately, browsers don't actually know how to send emails. The web browser only really knows how to render HTML, JS and CSS code into a visual experience.
PHP is a language that runs server-side, which you can use to tell a web server to send an email to whatever address you input.
Here's a good article on PHP Emailing: https://css-tricks.com/snippets/php/send-email/
It is important to note that this code REQUIRES a web-space or server to compile.
It will be a very basic email form, having said this I think you are missingpost argument in your form tag. The following should work
<form action="mailto:m_galvin1005#email.campbell.edu" method="post" enctype="text/plain" >
Name:<input type="text" name="Name">
Email:<input type="text" name="Email">
<input type="submit" name="submit" value="Submit">
</form>
Long and short, I had a form input button on my site that worked as an access code to redirect to a specific page on the site. Site broke, and now I don't remember the code I had in place. It was done a long time ago and I only had to do it once. But the gist of it looks like this:
For example the address to site is www.brokensite.com. I had a form input field on the page where the value of the input field when submitted redirected to the page www.brokensite.com/inputvalue. So if I input the access code of helpme, it would redirect to www.brokensite.com/helpme
My current code is:
<form action="/after-school-registration/" method="$_GET" name="access">
<input name="code" value="" type="Text">
<input value="Go" type="Submit">
</form>
Please tell me what I am missing. Or what I did wrong this time. Any help is appreciated.
You could use JavaScript and set the location:
<form>
<input id='urlpage' />
<button type="button" onclick="window.location.href='/after-school-registration/' + document.getElementById('urlpage').value">Go</button>
</form>
So, HTML newbie here and am having an issue where I have a website that just hosts files. I have a working search function on the site in two places. One on the homepage where the search works perfectly fine. Once a search is inputed (searching 'pop' for instance), the url states:
http://website.com/?op=catalogue&k=pop&ftype=
But, on the second page, when I input a search term, it seems to add to the url and doesnt go anywhere. For example:
http://website.com/e2aqev6btnnv/head.jpg?op=catalogue&k=pop&ftype=
Instead of erasing the head.jpg file in the URL and accepting the new search term, it just adds it and the page doesn't go anywhere. Please help
Here is the code I have for the search:
<br>
<Form method="GET" action="">
<input type="hidden" name="op" value="catalogue">
<input type="search" onfocus="fieldReceivedFocus()" name="k" id="search" value="">
try this:
<Form method="GET" action="http://website.com">
what will tell it what page to send the form data to, in your case it is the main page, otherwise it sends it to the current page.
You MAY need to change
<input type="hidden" name="op" value="catalogue">
to
<input type="hidden" name="op" value="search">
I don't know how the backend of your site is coded but based on what I see in the urls i think you will need to.