HTML input form to external link - html

I am working on a new project and decided to do a lot of the coding myself, I am by no means a web developer but here we are :)
So....
I am coming towards the end of coding and just linking a few things up, I have WHMCS running on a vhost based external link and I need my domain search form to direct people from my main website to the vhost external link.
Here is the code I have so far...
<form method="post" action="https://bill.spacesrv.com/cart.php?a=add&domain=register&" target="_blank" class="uk-form idz-search-domain-form">
<fieldset>
<input type="text" class="uk-form-large uk-width-1-1" name="query" value="" placeholder="find your perfect domain name">
<button type="submit" class="uk-button-large idz-button blue uppercase">Find Domain</button>
</fieldset>
</form>
I have the domain in the action tag, I need that to stay the same and what the customer will search in the search box needs to go on the end of the domain.
This is what the final link should look like...
https://bill.spacesrv.com/cart.php?a=add&domain=register&query=domain.com
But currently when I hit the search button it is going to this link...
https://bill.spacesrv.com/cart.php?a=add&domain=register&
It is not adding the query={searched domain} to the end of the link.

It is a WHMCS link which is open for the world to see anyway, its not a link that needs to be hidden.

Nothwithstanding the fact that you need to take care of security ( dont open the target page for forms coming from anywhere ), you just need to specify the GET method for the form :
<form method="get" action="https://my.page.com?a=add" target="_blank" class="uk-form idz-search-domain-form">

Related

HTML form using gmail without backend?

I am trying to figure out if there is a way to use GMAIL in an HTML contact form without a backend, like formspree ie. Does GMAIL give an API key for this purpose?
I made a little Heroku app for doing this, it requires no login and completely free without any asterisks. Best for static sites!
Requirements:
All inputs must have a name property,
The action property must be "http://form-delivr.herokuapp.com/handler/yourEmailAddress",
The method property must be post,
If anyone submits the form, the data will be mailed back to the email address you provided in the action property!
Example:
<form action="http://form-delivr.herokuapp.com/handler/tony#mail.com" method="post">
<h4>Username:</h4>
<input name="username">
<h4>Email:</h4>
<input type="email", name="email">
<button type="submit">Submit</button>
</form>
Note: I will be changing on this so stay tuned or your form may stop working suddenly if you use this :(

Input website into text field, click GO and person is taken to the website from my website

I need a simple html code so that a visitor to my website can type in a textfield what website they would like to visit next and click GO and they are taken there.
I can't seem to find how to do this anywhere. Can't even find any websites that have a similar code.
Here is a quick implementation that will set it based on the text field value. I would suggest putting in validation and much more.
function goToUrl(form){
window.location = form.url.value
}
<form onsubmit="goToUrl(this)">
<input type="text" id="url" />
<button type="submit">Go to URL</button>
</form>

Using POST in an HTML form

I am using POST in an HTML form to POST large number of arguments.
I wrote something like this:
<form action="get_status_aisleid.html" method="POST">
<input type="hidden" name="aisleId" value=<% $aisle_id %> />
<input type="hidden" name="enter code heretype" value="verified" />
<input type="hidden" name="value" value=<% $values[1]%> />
<a href="#" onclick="this.parentNode.submit()">
<% $verifiedbaySize %>
</a>
</form>
Everything works fine, if I click on a link in the same window.
But if I right click and open it in a new tab, then my new file (which is doing some operations on arguments passed and then downloading a file) is not called. Instead, the same page is refreshed.
Can someone please suggest something?
Right clicking an opening in a new window will always follow the link (i.e. href="#" meaning "Go to the top of the page". The JavaScript won't run.
No built in control of the browser will submit a form while giving the user the option to choose if it should be in the same or a new window.
This isn't normally a useful choice anyway - opening in a new window is something usually done when the user intends to return to the current page to pick up where they left off, and a form is not something normally presented in the middle of another task.
The closet you could come would be to add a second JavaScript triggered control that sets the target attribute of the form to _blank before triggering submission.

Iframe source to be a dynamic URL

Not using iFrames very often so I could really do with your help here...
I have a form on a webpage which opens an external online booking engine with availability depending on the dates selected in the form.
I'd like to open the external booking page in an iframe named "mainframe" on a new page, book.html.
The start and end code for the form is:
Code:
<form name="roseform" method="post" action="http://www.hotelexec.co.uk/external.asp"></form>
<input type="text" class="dimmed" placeholder="Brasil" id="keywords" name="keywords" />
Search
How would I set the target to "mainframe" at the book.html page so the results from the form would be displayed there? I understand I need to make Iframe source to be a dynamic URL.
Thanks,
Blazer
Just add target attribute.
<form name="roseform" target="mainframe" method="post" action="http://www.hotelexec.co.uk/external.asp"></form>
UPDATE
As I understood you need this steps:
For start change .html to .php
Change action of form in itmjobs.ro/lidl/page1.php to point page2.html
<form name="roseform" method="post" action="http://itmjobs.ro/lidl/page2.php"></form>
In page2.php add iframe with address http://itmjobs.ro/search-results-jobs/
<iframe src="http://itmjobs.ro/search-results-jobs/?<?php echo http_build_query($_POST)?>"></iframe>
Now you will see data from http://itmjobs.ro/search-results-jobs/ in your iframe.

PayPal button / hidden inputs in html email

I have a working PayPal button on my website. It's not hosted by PayPal, I just wrote the code myself. It looks like this:
<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<INPUT TYPE='hidden' name='cmd' value='_donations'>
<INPUT TYPE='hidden' name='business' value='myemail#myhost.com'>
<INPUT TYPE='hidden' name='item_name' value='$item'>
<INPUT TYPE='hidden' name='item_number' value='$number'>
<INPUT TYPE='hidden' name='amount' value='$payment'>
<input type='image' src='http://www.switchonthree.com/imgs/buynow.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>
<img alt='' border='0' src='https://www.paypalobjects.com/en_US/i/scr/pixel.gif' width='1' height='1'>
</form>
Works great. When I take the same code and embed it in an html email, the button is there and it looks fine, but the link just goes to the PayPal homepage. It appears that none of the hidden inputs are working. Can you have hidden inputs in an email? Is there a workaround? Thanks.
It could be a security feature from Palpal. It could be that submitting the form in email does not result in a referer address that palpay reads. This is, it is blank.
So I think Paypal does not trust the form post and is redirecting you to their front page.
In general, posting a form via email seems strange and insecure to me.
The workaround is to direct users to a website to complete the purchase of which they would submit the form you have above from that website.
It seems that most modern email clients won't allow/support forms as they see it as a security risk, so its practice is not recommended.
I think the problem you are having is that you are doing a POST instead of a GET so changing it to the following may do the trick
<form action='https://www.paypal.com/cgi-bin/webscr' method='get'>
see this article
Read this article "Do forms work in HTML emails?" from CampaignMonitor for more info
In this article from MailChimp, they make a good suggestion to have an online version of your form which can be linked to from the email.
Don't use forms in email. Ever.
You could use https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=xxxx&amount=xxxx&item_name=xxxx but really, why not go for a PayPal 'hosted button'? That way you at least won't be exposing the amount to the public, leaving it open to manipulation.
Simply set up the hosted button (tick 'Host button with PayPal' in Step 2 of the button creation tool), and at the end of it you'll be shown the code along with an 'E-mail' tab with a shortened email link for your button which you can use in emails.