Input element not returning user input/ or null for no input

Here is the link to what I’m working on:

https://www.codecademy.com/paths/web-development/tracks/learn-html-web-dev-path/modules/learn-html-forms/projects/form-a-story

Here is a piece of code that I’m having a problem with:
All the code before this section here is prewritten within the exercise. So there are no errors there.

label for=“animal-1”>Animal:</label
input id=“animal-1” name=“animal-1” type=“text” required
!–Add your form below:–>
form action=“story.html” method=“GET”
input type=“submit” value=“Form My Story”
form

1.) Input still returns null.
2.) Even with the ‘required’ attribute you can submit the form.

I’ve gone over and over this and cannot find the solution. Checked, rechecked, and tripled + quadruple checked ‘id’ and ‘name’ spelling.
Check all the opening/ closing tags.

Same issue - even though this is a really old post.

Hi,

Is this how you have your code formatted?

<label for="animal-1">Animal:</label>
<input id="animal-1" type="text" required>
<!--Add your form below:-->
<form action="story.html" method="GET">
  <input type="submit" value="Form My Story!">
</form>

If so, you would need to make sure that the <label> and <input> for animal-1 are nested within the <form>.

<form action="story.html" method="GET">
  <label for="animal-1">Animal:</label>
  <input id="animal-1" type="text" required>
  <br>
  <input type="submit" value="Form My Story!">
</form>

That should fix the problem you are having. If not, could you paste your text within preformatted text?

1 Like

From what I can tell - I do have it within the tag:

CODE:

<!--Add your form below:-->
      <form action="story.html" method="POST">
        <label for="animal-1">Animal:</label>
        <input type="text" id="animal-1" name="animal-1" required />
        <br>
        <label for="animal-2">Another Animal:</label>
        <input id="animal-2" name="animal-2" type="text" required />
        <br>
        <label for="animal-3">One More Animal</label>
        <input id="animal-3" name="animal-3" type="text" required />
        <br>
        <label for="adj-1">Adjective (past tense)</label>
          <input id="adj-1" name="adj-1" type="text" required />
          <br>
          <label for="verb-1">Verb(ends in - ing):</label>
          <input id="verb-1" name="verb-1" type="text" required />
          <br>
          <label for="num-1">Number:</label>
          <input id="num-1" type="number" required />
          <br>
          <span>Yes or No:</span>
          <br>
          <input type="radio" id="yes" name="answer" value="yes" required /> <label for="yes">Yes</label>
          <input type="radio" id="no" name="answer" value="no" required /> <label for="no">No</label>
          <br>
        <label for="speed">Relative speed (ends in -er):</label>
        <select id="speed" name="speed">
          <option value="faster">Faster</option>
          <option value="fast">Fast</option>
        </select>
        <br>
        <label for="quote">Motivational Quote:</label>
        <input list="quote-choices" type="text" id="quote" name="quote" required>
        <datalist id="quote-choices">
          <option value="winner gets ice cream!"></option>
        </datalist>
        <br>
        <label for="message">Meaningful Message:</label>
        <textarea rows="8" cols="40" required></textarea>
        <br>
        <input type="submit" value="Form My Story!">
      </form>

The method here you will want to make GET and not POST.

The input here is missing name=“num-1”, so, it’s not being sent.

Then same thing here, the text area is missing an id and name attribute. Once all of these are adjusted, your form should work! Edit: I’m realizing now that when I originally responded, I, too, forgot the name attribute! My mistake.