Table not displaying all of data entered












1















so I have this table form that when you hit submit, it should display the information entered. but it only displays the first input entered. I have another table just like this one that works fine, so it must be a small thing that I'm just not seeing.



The table where you enter data:



<form id="symptomstable" name="symptomstable">
<table class="symptoms" width="700px" bgcolor="#BDDBCC" border="3" align="center">
<th><b>Symptoms</b></th>
<tr>
<td><input type="text" name="sym1" size="100" id="sym1"></td>
</tr>
<tr>
<td><input type="text" name="sym2" size="100" id="sym2"></td>
</tr>
<tr>
<td><input type="text" name="sym3" size="100" id="sym3"></td>
</tr>
<tr>
<td><input type="text" name="sym4" size="100" id="sym4"></td>
</tr>
<tr>
<td><input type="text" name="sym5" size="100" id="sym5"></td>
</tr>
<tr>
<td><input type="text" name="sym6" size="100" id="sym6"></td>
</tr>

<tr>
<td align="center"><input type="button" value="Submit" name="submit" id="submit" onClick="display1()"/></td>
</tr>
</table>


Where it outputs to:



<table width="900px" align="center" border=1> 
<tr style="background-color:#BDDBCC;"></br>
<th align="center"><b>Symptoms Log</b></th>
</tr>
<tr>
<td align="center"><div id="symarea1"></div></td>
</tr>
<tr>
<td align="center"><div id="symyarea2"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea3"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea4"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea5"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea6"></div></td>
</tr>
</table>


The javascript:



function display1()
{
document.getElementById("symarea1").innerHTML = document.getElementById("sym1").value;
document.getElementById("sym1").value = "";
document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
document.getElementById("sym2").value = "";
document.getElementById("symarea3").innerHTML = document.getElementById("sym3").value;
document.getElementById("sym3").value = "";
document.getElementById("symarea4").innerHTML = document.getElementById("sym4").value;
document.getElementById("sym4").value = "";
document.getElementById("symarea5").innerHTML = document.getElementById("sym5").value;
document.getElementById("sym5").value = "";
document.getElementById("symarea6").innerHTML = document.getElementById("sym6").value;
document.getElementById("sym6").value = "";
}









share|improve this question



























    1















    so I have this table form that when you hit submit, it should display the information entered. but it only displays the first input entered. I have another table just like this one that works fine, so it must be a small thing that I'm just not seeing.



    The table where you enter data:



    <form id="symptomstable" name="symptomstable">
    <table class="symptoms" width="700px" bgcolor="#BDDBCC" border="3" align="center">
    <th><b>Symptoms</b></th>
    <tr>
    <td><input type="text" name="sym1" size="100" id="sym1"></td>
    </tr>
    <tr>
    <td><input type="text" name="sym2" size="100" id="sym2"></td>
    </tr>
    <tr>
    <td><input type="text" name="sym3" size="100" id="sym3"></td>
    </tr>
    <tr>
    <td><input type="text" name="sym4" size="100" id="sym4"></td>
    </tr>
    <tr>
    <td><input type="text" name="sym5" size="100" id="sym5"></td>
    </tr>
    <tr>
    <td><input type="text" name="sym6" size="100" id="sym6"></td>
    </tr>

    <tr>
    <td align="center"><input type="button" value="Submit" name="submit" id="submit" onClick="display1()"/></td>
    </tr>
    </table>


    Where it outputs to:



    <table width="900px" align="center" border=1> 
    <tr style="background-color:#BDDBCC;"></br>
    <th align="center"><b>Symptoms Log</b></th>
    </tr>
    <tr>
    <td align="center"><div id="symarea1"></div></td>
    </tr>
    <tr>
    <td align="center"><div id="symyarea2"></div></td>
    </tr>
    <tr>
    <td align="center"><div id="symarea3"></div></td>
    </tr>
    <tr>
    <td align="center"><div id="symarea4"></div></td>
    </tr>
    <tr>
    <td align="center"><div id="symarea5"></div></td>
    </tr>
    <tr>
    <td align="center"><div id="symarea6"></div></td>
    </tr>
    </table>


    The javascript:



    function display1()
    {
    document.getElementById("symarea1").innerHTML = document.getElementById("sym1").value;
    document.getElementById("sym1").value = "";
    document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
    document.getElementById("sym2").value = "";
    document.getElementById("symarea3").innerHTML = document.getElementById("sym3").value;
    document.getElementById("sym3").value = "";
    document.getElementById("symarea4").innerHTML = document.getElementById("sym4").value;
    document.getElementById("sym4").value = "";
    document.getElementById("symarea5").innerHTML = document.getElementById("sym5").value;
    document.getElementById("sym5").value = "";
    document.getElementById("symarea6").innerHTML = document.getElementById("sym6").value;
    document.getElementById("sym6").value = "";
    }









    share|improve this question

























      1












      1








      1








      so I have this table form that when you hit submit, it should display the information entered. but it only displays the first input entered. I have another table just like this one that works fine, so it must be a small thing that I'm just not seeing.



      The table where you enter data:



      <form id="symptomstable" name="symptomstable">
      <table class="symptoms" width="700px" bgcolor="#BDDBCC" border="3" align="center">
      <th><b>Symptoms</b></th>
      <tr>
      <td><input type="text" name="sym1" size="100" id="sym1"></td>
      </tr>
      <tr>
      <td><input type="text" name="sym2" size="100" id="sym2"></td>
      </tr>
      <tr>
      <td><input type="text" name="sym3" size="100" id="sym3"></td>
      </tr>
      <tr>
      <td><input type="text" name="sym4" size="100" id="sym4"></td>
      </tr>
      <tr>
      <td><input type="text" name="sym5" size="100" id="sym5"></td>
      </tr>
      <tr>
      <td><input type="text" name="sym6" size="100" id="sym6"></td>
      </tr>

      <tr>
      <td align="center"><input type="button" value="Submit" name="submit" id="submit" onClick="display1()"/></td>
      </tr>
      </table>


      Where it outputs to:



      <table width="900px" align="center" border=1> 
      <tr style="background-color:#BDDBCC;"></br>
      <th align="center"><b>Symptoms Log</b></th>
      </tr>
      <tr>
      <td align="center"><div id="symarea1"></div></td>
      </tr>
      <tr>
      <td align="center"><div id="symyarea2"></div></td>
      </tr>
      <tr>
      <td align="center"><div id="symarea3"></div></td>
      </tr>
      <tr>
      <td align="center"><div id="symarea4"></div></td>
      </tr>
      <tr>
      <td align="center"><div id="symarea5"></div></td>
      </tr>
      <tr>
      <td align="center"><div id="symarea6"></div></td>
      </tr>
      </table>


      The javascript:



      function display1()
      {
      document.getElementById("symarea1").innerHTML = document.getElementById("sym1").value;
      document.getElementById("sym1").value = "";
      document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
      document.getElementById("sym2").value = "";
      document.getElementById("symarea3").innerHTML = document.getElementById("sym3").value;
      document.getElementById("sym3").value = "";
      document.getElementById("symarea4").innerHTML = document.getElementById("sym4").value;
      document.getElementById("sym4").value = "";
      document.getElementById("symarea5").innerHTML = document.getElementById("sym5").value;
      document.getElementById("sym5").value = "";
      document.getElementById("symarea6").innerHTML = document.getElementById("sym6").value;
      document.getElementById("sym6").value = "";
      }









      share|improve this question














      so I have this table form that when you hit submit, it should display the information entered. but it only displays the first input entered. I have another table just like this one that works fine, so it must be a small thing that I'm just not seeing.



      The table where you enter data:



      <form id="symptomstable" name="symptomstable">
      <table class="symptoms" width="700px" bgcolor="#BDDBCC" border="3" align="center">
      <th><b>Symptoms</b></th>
      <tr>
      <td><input type="text" name="sym1" size="100" id="sym1"></td>
      </tr>
      <tr>
      <td><input type="text" name="sym2" size="100" id="sym2"></td>
      </tr>
      <tr>
      <td><input type="text" name="sym3" size="100" id="sym3"></td>
      </tr>
      <tr>
      <td><input type="text" name="sym4" size="100" id="sym4"></td>
      </tr>
      <tr>
      <td><input type="text" name="sym5" size="100" id="sym5"></td>
      </tr>
      <tr>
      <td><input type="text" name="sym6" size="100" id="sym6"></td>
      </tr>

      <tr>
      <td align="center"><input type="button" value="Submit" name="submit" id="submit" onClick="display1()"/></td>
      </tr>
      </table>


      Where it outputs to:



      <table width="900px" align="center" border=1> 
      <tr style="background-color:#BDDBCC;"></br>
      <th align="center"><b>Symptoms Log</b></th>
      </tr>
      <tr>
      <td align="center"><div id="symarea1"></div></td>
      </tr>
      <tr>
      <td align="center"><div id="symyarea2"></div></td>
      </tr>
      <tr>
      <td align="center"><div id="symarea3"></div></td>
      </tr>
      <tr>
      <td align="center"><div id="symarea4"></div></td>
      </tr>
      <tr>
      <td align="center"><div id="symarea5"></div></td>
      </tr>
      <tr>
      <td align="center"><div id="symarea6"></div></td>
      </tr>
      </table>


      The javascript:



      function display1()
      {
      document.getElementById("symarea1").innerHTML = document.getElementById("sym1").value;
      document.getElementById("sym1").value = "";
      document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
      document.getElementById("sym2").value = "";
      document.getElementById("symarea3").innerHTML = document.getElementById("sym3").value;
      document.getElementById("sym3").value = "";
      document.getElementById("symarea4").innerHTML = document.getElementById("sym4").value;
      document.getElementById("sym4").value = "";
      document.getElementById("symarea5").innerHTML = document.getElementById("sym5").value;
      document.getElementById("sym5").value = "";
      document.getElementById("symarea6").innerHTML = document.getElementById("sym6").value;
      document.getElementById("sym6").value = "";
      }






      javascript html






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 27 '18 at 23:02









      Jackie Jackie

      615




      615
























          1 Answer
          1






          active

          oldest

          votes


















          1














          You just have a typo. If you open up your console after trying to submit the form, you will see that you have an error that says Cannot set property 'innerHTML' of null. If you look at the line it refers to, you will see that it references document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;



          In your HTML, the ID of this element is currently symyarea2. See: <td align="center"><div id="symyarea2"></div></td>.



          Check out how to use the console in Firefox and Chrome






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53509562%2ftable-not-displaying-all-of-data-entered%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You just have a typo. If you open up your console after trying to submit the form, you will see that you have an error that says Cannot set property 'innerHTML' of null. If you look at the line it refers to, you will see that it references document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;



            In your HTML, the ID of this element is currently symyarea2. See: <td align="center"><div id="symyarea2"></div></td>.



            Check out how to use the console in Firefox and Chrome






            share|improve this answer




























              1














              You just have a typo. If you open up your console after trying to submit the form, you will see that you have an error that says Cannot set property 'innerHTML' of null. If you look at the line it refers to, you will see that it references document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;



              In your HTML, the ID of this element is currently symyarea2. See: <td align="center"><div id="symyarea2"></div></td>.



              Check out how to use the console in Firefox and Chrome






              share|improve this answer


























                1












                1








                1







                You just have a typo. If you open up your console after trying to submit the form, you will see that you have an error that says Cannot set property 'innerHTML' of null. If you look at the line it refers to, you will see that it references document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;



                In your HTML, the ID of this element is currently symyarea2. See: <td align="center"><div id="symyarea2"></div></td>.



                Check out how to use the console in Firefox and Chrome






                share|improve this answer













                You just have a typo. If you open up your console after trying to submit the form, you will see that you have an error that says Cannot set property 'innerHTML' of null. If you look at the line it refers to, you will see that it references document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;



                In your HTML, the ID of this element is currently symyarea2. See: <td align="center"><div id="symyarea2"></div></td>.



                Check out how to use the console in Firefox and Chrome







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 27 '18 at 23:27









                Katie.SunKatie.Sun

                587114




                587114
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53509562%2ftable-not-displaying-all-of-data-entered%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Lallio

                    Futebolista

                    Jornalista