title: How to include spaces in req.body variables
body: <p>Let's say I have a variable:</p>
  
  <pre><code>var name = "Joe Smith"
  </code></pre>
  
  <p>That I want to include in a POST request via form + option so that I add Joe Smith to my database.</p>
  
  <p>I have already created my form and options and verified that it sends over the name to my controllers/middleware.</p>
  
  <p>I would expect that when I send over the name in the POST request, a call to:</p>
  
  <pre><code>req.body.name
  </code></pre>
  
  <p>on the server side would return:</p>
  
  <pre><code>Joe Smith
  </code></pre>
  
  <p>However, for some reason white spaces are ignored and req.body.name evaluates to:</p>
  
  <pre><code>Joe
  </code></pre>
  
  <p>Similar variables with white spaces in their names/values have this error and as a result I cannot look up these objects in the database and update properly. How can I resolve this issue?</p>
  
  <p>Thank you!</p>
  
  <p>EDIT: Here is my script code--I used jQuery to populate options in a select with the names of people in my database</p>
  
  <pre><code>$(function() {
  
    var $people = $("#people");
       $.ajax({
          type: 'GET',
          url: '/getAllPeopleData',
          success: function(people) {
              $.each(people, function(i, person) {
                 $people.append('&lt;option value=' + person.name + '&gt;' + 
                 person.name + '&lt;/option');
                });
              }
           });
       });
  </code></pre>
  
  <p>My form allows the user to select one person's name and adds it to the database:</p>
  
  <pre><code>    &lt;form action="/addPerson" method="POST"&gt;
          Select a Person: &lt;br&gt;
          &lt;select id="people" name="name"&gt;&lt;/select&gt; &lt;br&gt;
          &lt;input type="submit" value="Submit"&gt; &lt;br&gt;
      &lt;/form?
  </code></pre>