Passing advanced search query from html form - html

I'm trying to pass a couple of search queries (allintitle and allinurl) from an HTML form to Google. I tried to use the example found below by inserting these parameters (as_occt=title and as_occt=url) but wasn't able to get it to work.
<form action="https://google.com/search">
All these words:<input type="text" name="as_q" >
<br><br>Exact word/phrase:<input type="text" name="as_epq" >
<br><br>Any of these words:<input type="text" name="as_oq" >
<br><br>None of these words:<input type="text" name="as_eq" >
<br><br>
<input type="submit" value="advanced search">
</form>

Related

Input pattern - Mobile number - Start with a specific numbers

I trying to configure the pattern to be able to submit a mobile number that should start with 09 followed by a '0-9' digits. Total max characters are 11.
Sample: 09493432199 or 09267778595
<form action="/action_page.php">
<label for="username">Username:</label>
<input type="text" id="username" name="username" pattern="[09]+[0-9]" maxlength="11"><br><br>
<input type="submit" value="Submit">
</form>
Your html seems nice
<form action="/action_page.php">
<label for="username">Username:</label>
<input type="text" id="username" name="username" pattern="[0-9]" maxlength="11"><br><br>
<input type="submit" value="Submit">
</form>
You need also have JS like follow :
var username_prefix = $('#username').subsubstr(0,2);
$('#validate').click(function(){
if (username_prefix == 09) {
alert('correct');
}
else {
alert('incorrect');
}
});
Use an expression with fixed digits plus a specific amount of digits.
If you need the exact 11 characters, then use 09[0-9]{9}
In this example 09[0-9]{8,9} are valid 0912345678 and 09123456789
<form action="/action_page.php">
<label for="username">Username:</label>
<input type="text" id="username" name="username" pattern="09[0-9]{8,9}" maxlength="11"><br><br>
<input type="submit" value="Submit">
</form>
As a side note, even if using input pattern is supported by the most common browsers, you should not rely only on the client side validation. Use a similar validation from the PHP backend to verify the information (in this case additional ^ (start of expression) and $ (end of expression) were added.
if (!preg_match("/^09[0-9]{9}$/",$_GET["username"])){
// not valid
}
You can use this RegExp
It will match
when the number starts with 09 AND
when the number has exactly 11 digits
pattern = /09[0-9]{9}/
Try it out here
https://regex101.com/r/Nl2c2y/3
<form action="/action_page.php">
<label for="username">Username:</label>
<input type="text" id="username" name="username" pattern="09[0-9]{9}" maxlength="11"><br><br>
<input type="submit" value="Submit">
</form>
<form action="/action_page.php">
<label for="username">Username:</label>
<input type="text" id="username" name="username" pattern="[0-9]" title="Zero is required" maxlength="11"><br><br>
<input type="submit" value="Submit">
</form>

Format of URL for advanced Google search engine query

I am trying to find the advanced search query for HTML to automatically search the results.
For example, a plain google.com query is https://google.com/search, while image search query is https://images.google.com/images
I can't find the query to automatically search the values from 4 text boxes through the Advanced Search engine.
The functionality I am looking for is that when I try searching for keywords from my web page it should go through the advanced search engine:
<form action="https://www.google.com/advanced_search?as_q=q&as_epq=r&as_oq=s&as_eq=t">
I found an alternative to going through the Advanced Search engine.
The Advanced Search has a few parameters that are passed in the URL for a search query:
all these words: the operator passed is as_q like this.
<input class="" type="text" name="as_q">
this exact word or phrase: the operator passed is as_epq
any of these words: the operator passed is as_oq
none of these words: the operator passed is as_eq
So I named the HTML textboxes with the corresponding names and concatenated the above parameters to the search query.
For the first section of the advanced search, try
<form action="https://google.com/search" name="f">
<div class="field">
<label for="field1">all these words:</label>
<input type="text" class="textinput" id="field1" value="" name="as_q">
</div>
<br>
<div class="field">
<label for="field2">this exact word or phrase: </label>
<input type="text" class="textinput" id="field2" value="" name="as_epq">
</div>
<br>
<div class="field">
<label for="field3">any of this words: </label>
<input type="text" class="textinput" id="field3" value="" name="as_oq">
</div>
<br>
<div class="field">
<label for="field4">none of these words: </label>
<input type="text" class="textinput" id="field4" value="" name="as_eq">
</div>
<br>
<div class="field">
<label for="field5">numbers ranging from: </label>
<input type="text" class="textinput1" id="field5" value="" name="as_nlo">
<span class="seperator">to</span>
<input type="text" class="textinput2" id="field5" value="" name="as_nhi">
</div>
<input type="submit" value="advanced search">
</form>
If you are trying to create HTML page, I would like to share this code.
You can add a space for a right indentation using & nbsp;.
Here is an example:
<form action="https://google.com/search">
All these words:<input type="text" name="as_q" >
<br><br>Exact word/phrase:<input type="text" name="as_epq" >
<br><br>Any of these words:<input type="text" name="as_oq" >
<br><br>None of these words:<input type="text" name="as_eq" >
<br><br> <input type="submit" value="advanced search">
</form>

Linking custom HTML Form to Google Form (How to handle Date input?)

I am trying to link a custom HTMl form to an existing Google Form. I have matched the action and name attributes to the form (placeholders in html snippet below for privacy).
My custom Form
<form action="https://docs.google.com/forms/PLACEHOLDERurl" method="post">
<div class="form-group">
<label class="mb-0" for="name">First & Last Name</label>
<input class="form-control" name="entry.PLACEHOLDER" type="text" id="name" placeholder="Enter name" required>
</div>
<div class="form-group">
<label for="date" class="mb-0">Pick Up Date</label>
<input id="pick-up-date" type="date" class="form-control">
</div>
<button id="testFormSubmit" type="submit" value="submit" class="btn btn-main-color">Submit</button>
</form>
However, there are 3 "name" attributes for the date input on the google form.
Main date input from Google Form
<input type="date" class="quantumWizTextinputPaperinputInput exportInput" jsname="YPqjbf" autocomplete="off" tabindex="0" value="" data-initial-value="2020-04-14" badinput="false" dir="ltr">
3 hidden inputs for each name value (year, day, month) from Google Form
<input type="hidden" name="entry.2099319546_year" jsname="L9xHkb_year" value="2020">
<input type="hidden" name="entry.2099319546_month" jsname="L9xHkb_month" value="4">
<input type="hidden" name="entry.2099319546_day" jsname="L9xHkb_day" value="14">
Can someone please let me know how I can alter my custom date form input to match this format?
I was dealing with same problem but turns out the solution is pretty easy.
You just need to delete the underscore value ('_year') and use only the entry id.
entry.2099319546
Doesn't matter that they have three different inputs and you only have one, Google will recognize it no matter way.
Check this tutorial from Codepen

HTML label control doesn't pass form data to controller

This format of html form control doesn't pass form data
<form action="index.php?action=createNewCustomer"
method="POST">
<fieldset>
<label class="field" for="firstName">First Name:</label>
<input type="text">
</fieldset>
<input type="submit">
</form>
but this one does
<form action="index.php?action=createNewCustomer"
method="POST">
<fieldset>
<label>First Name:</label>
<input type="text" name="firstName">
</fieldset>
<input type="submit">
</form>
Unless I'm missing something obvious, the difference is in the label control..Are both valid and if so, can anyone explain to me why only the second one passes form data to my PHP controller method.
<input type ="submit"> is not part of the fieldset in the first bit of code, but I don't think that's really the issue.
I believe changing the code on the first bit to:
<form action="index.php?action=createNewCustomer"
method="POST">
<fieldset>
<label for = "firstName">First Name: </label>
<input type="text" name = "firstName">
<input type="submit">
</fieldset>
</form>
will work. You need to make sure the name of the input is the same as the property you are trying to set.

Form not taking action

I have a problem with a form. It is not sending any action (page not even refreshing on click). If I copy the form in another document locally it has no problem, all working well, mail message being sent. Here is the code of the form:
<form method='post' name='ContactForm' id='contactForm' action='contact_main.php'>
<p>Your name:</p>
<input type="text" class="input-box" name="user-name" placeholder="Please enter your name.">
<p>Email address:</p>
<input type="text" class="input-box" name="user-email" placeholder="Please enter your email address.">
<p>Subject:</p>
<input type="text" class="input-box" name="user-subject" placeholder="Purpose of this message.">
<p class="right-message-box">Message:</p>
<textarea class="input-box right-message-box message-box" name="user-message" placeholder="Your message."></textarea>
<button type='submit' class='myinputbtn' name='submitf' id="submitf">Send your message</button>
<div id='message_post'></div>
<input type="hidden" name="contact">
</form>
Clicking the submit button results in... nothing!
Please let me know if I need to edit my question before downrating. Thanks!
Use
<input type="submit" ...
instead of a button (which is used with Javascript, not for form submitting)