send time posting this...custom search form....need help please - html

I have a search form i made for a wordpress site.....visually it is good but still not functional.....please let me know what im missing here.
<body>
<form id="start" action="/">
<h1>Search our site</h1>
<p>
<label for="name">Entry</label>
<input type="text" id="name" size="35" />
</p>
<p> </p>
</p-->
<p>
<label>
<input type="checkbox" name="posts" id="posts" />
posts</label>
<label>
<input type="checkbox" name="pages" id="pages" />
pages</label>
<a class="submit" href="#">Submit</a></p>
</form>
<p id="credits"> </p>
</body>

You need to provide a way to submit the form.
<a class="submit" href="#" onclick="document.getElementById('start').submit()">Submit</a>

Based on the comments, we now know what you are trying to do. Your original question was not very specific.
In addition to the missing submit button, you also need to make sure you pass the correct variables in your form to the Wordpress search function. In your example:
<label for="name">Entry</label>
<input type="text" id="name" size="35" />
This code will handle the user input for the search term, I assume. The second line, the input element, needs a name like so:
<label for="name">Entry</label>
<input type="text" id="name" size="35" name="s" />
When this is submitted you will see the s=foo in the URL and that will tell Wordpress that it is doing a search.
I found this out by looking at the source code for a default wordpress search form. I'm not sure what the variables are needed for the other aspects of the form, "posts" and "pages", but you can examine a standard wordpress search form (maybe advanced search?) and then name your form elements appropriately.
Good luck!

Related

My form doesn’t show info when someone submits, for example I’ll receive the name, email, message but it’ll be blank

I’m using the FormSubmit API.
When a person fills out the form and submits it, whatever they have filled out doesn’t show and I just receive an empty form.
<section id="form-section" class="fade-contact">
<h2 id="form-title" class="fade-contact">Get in touch</h2>
<form action="https://formsubmit.co/8421d4ce6448fbeda493e2c8ce639a8e" method="POST" id="form">
<!-- <input type="hidden" name="_captcha" value="false"> -->
<!-- <input type="hidden" name="_autoresponse" value="Thank you for getting in touch!"> -->
<div class="name-email fade-contact">
<input type="text" name="name" placeholder="YOUR NAME" id="form-name" required>
<input type="email" name="email" placeholder="YOUR EMAIL" id="form-email" required>
</div>
<input type="text" name="textarea" placeholder="YOUR MESSAGE" id="form-message" class="fade-contact" required>
<button type="submit" class="btn submit-btn fade-contact">submit</button>
</form>
</section>
I corrected the name attribute to not use 2 of the same values but still it doesn’t work!
Here is an image of the formsubmitAPI website instructions
screenshot of formsubmitAPI guide
btw I hosted with netlify just incase that helps
I FIXED IT!!!!!!!
Turns out I had some JavaScript to clear the input values after submission and that was somehow affecting the form. I guess the input values were clearing before the form was submitting hence I was getting blank emails.
I just commented it out for now and will look into it later.
But…..I fixed it!! I’m so happy!
Thank you to everyone that helped

How do I get my submit button to work?

I am no expert in coding. As a matter of a fact this is my first true project in CSS. I created the page in Adobe Edge Reflow and exported CSS to dreamweaver. The problem I am running into is that I can't get my form to actually work. I want the form to send directly to my e-mail, in no specific format. Can anyone help me out?
<form method="post" novalidate>
<label id="formgroup">
<p id="text1">
Name*
</p>
<input id="textinput" type="text" value=" Your Name"></input>
</label>
<label id="formgroup1">
<p id="text2">
Company Name
</p>
<input id="textinput1" type="text" value=" Company Name"></input>
</label>
<label id="formgroup2">
<p id="text3">
Email*
</p>
<input id="textinput2" type="text" value=" email"></input>
</label>
<label id="formgroup3">
<p id="text4">
Message*
</p>
<input id="textinput3" type="text" value=" Your message"></input>
</label>
<input id="submit" type="submit" value="Send Message"></input>
<input type="hidden" name="recipient" value="xxx#gmail.com"> </form>
Your HTML markup seems fine for a simple form aimed to post the contents of a range of fields.
However, the HTML code (along with any CSS) will only enable you to determine the presentation/style of the form (i.e. how it looks).
Regarding the functionality of the application actually triggering an email with the form contents to an email address, this will require more code in a 'server-side' language such as PHP (HTML and CSS being 'client-side' languages).
Here is a good article that provides a tutorial on the subject: http://www.html-form-guide.com/php-form/php-form-tutorial.html
Your HTML markup is actually missing something, the "action" property, i.e.
Before:
<form method="post" novalidate>
After:
<form method="post" novalidate action="send-email.php">
As you might have guessed from looking at the above, this "action" property specifies the PHP script/file that triggers the email. And of course it is this file that you are currently missing.
Hope this helps.

Understanding HTML form code

i am bit confused about the code..This is login.php file..and action of the form is also in the same file.Can this happen? if,then same login form should open if user submit the form...i am making my website,where i want to use login/register form.
<form action="login.php" method="post" class="f-wrap-1">
<div class="req">
Not Registered?<br />
Forgot your Password?
</div>
<fieldset>
<h3>Member Login</h3>
<label for="firstname"><b>Username:</b>
<input id="username" name="username" type="text" class="f-name" autocomplete="on" tabindex="1" /><br />
</label>
<label for="password"><b>Password:</b>
<input id="password" name="password" type="password" class="f-name" autocomplete="off" tabindex="2" /><br />
</label>
<label for="code"><b>Security Code:</b>
<input id="code" name="code" type="text" class="f-name" autocomplete="off" tabindex="3" /><br />
</label>
<label for="code2"><b> </b>
<img src="image.php?" /><br />
</label>
<div class="f-submit-wrap">
<input type="submit" value="Submit" class="f-submit" tabindex="4" /><br />
</div>
</fieldset>
</form>
This is login.php file..and action of the form is also in the same file.Can this happen?
Yes
if,then same login form should open if user submit the form
Not necessarily. In a system like this, the form data will be processed by server side code. The logic will probably be something like:
If it is a GET request, send the browser the form.
Otherwise, if it is a POST request, then check the form data:
If it is valid login data, then: set a cookie to track the user and
tell the browser to get some other URL.
Otherwise, the login data is wrong: populate the form with an error message
and possibly default the values of the fields to the wrong data the user
entered, then send the form to the browser.
Populating the form with the invalid data doesn't make much sense in a login form like this one, but it more useful in (for example) a registration form.
Who wants to retype all their personal data again just because the username they wanted is not available or they missed a field?
It's possible to send form to same file but it's not in good style. You would have to check if post data is available and display proper view based on that.
Better way to do it is just change the action of the form to point to another file and in that file handle login logic.
<form action="file.php" method="post" class="f-wrap-1">

Multi-search, single search bar HTML

As the title states, I'm trying to incorporate many searches into one search bar. More specifically, Google and Amazon. I have setup a radio option to set which site to search when one is selected.
This is the code I currently have:
<form method="get" action="http://www.google.com/search">
<div align="center" style="font-size:75%">
<input type="text" name="q" size="25" maxlength="255" value="" />
<input type="submit" value="Google or Amazon Search" /></br>
<input type="radio" name="sitesearch" value="" />The Web
<input type="radio" name="sitesearch" value="yoursite.com" checked />This Site
</div>
</form>
I have this form for Amazon, but I'm just unsure how to code it into the one search bar.
<form action="http://amazon.com/s/ref=nb_sb_noss" method="get" target="_blank">
<input type="text" id="twotabsearchtextbox" name="field-keywords">
<input type="submit" value="Search" class="nav-submit-input">
</form>
Use JavaScript to change the actual form action in page's DOM (and other parameters, if needed), depending on the user selection (use onclick event on radio to montior for change for example). Simple as that. You won't be able to do that in pure HTML without using some kind of proxy server to redirect the requests and return the results appropriately.
document.your-form.action = (google_selected) ? "http://www.google.com/search" : "http://amazon.com/s/ref=nb_sb_noss";
etc.

Form field data history not retained

I have a form on a page that is shown via https:// as follows:
<form id="memberslogin_form" name="memberslogin_form">
<fieldset>
<legend>Login</legend>
<div>
<label for="membershipId">Membership number</label>
<input type="text" class="field" name="membershipId" id="membershipId""/>
</div>
<div>
<label for="memberPassword">Password</label>
<input size="18" type="password" class="field" maxlength="50" name="memberPassword" id="memberPassword" />
</div>
<div id="button_login">
<input type="button" value="Login" class="button" id="signin" name="signin"/>
</div>
</fieldset>
</form>
The form is uniquely named, as are the inputs.
However, successful logins do not cause the "membershipId" entries to be listed in the input recent entries \ history. This occurs in both FF3.6 and IE6+.
I believe the ability to store field history is browser-based via it's settings, but I cannot retain the input history over https:// forms?
Is this a typo in here only, or in actual page:
<input type="text" class="field" name="membershipId" id="membershipId""/>
See the extra ".
I don't know much about the mechanism of saving form value in FF, but all this time, my form input is saved even if it in https site.
Maybe you can try lastpass that can save a form input for later usage as well as the password securely.