title: how to make wordpress plugin form text field take numbers
body: <p>I have a form in a plugin I am creatingin wordpress.  The form is a simple test form and it has a hidden field and two text fields.  If I enter a number into the text fields, it doesn't process it when I hit submit, it takes to me a page that says</p>
  <p>It looks like nothing was found at this location. Maybe try a search?</p>
  <p>here is the entire plugin showing the form and the action that processes the form.</p>
  <pre><code>&lt;?php
  /*
  plugin name: deano plugin
  description: deano test database to insert data into books table
  author: Dean-O
  
  */
  $path = preg_replace('/wp-content.*$/', '', __DIR__);
  require_once($path.'/wp-load.php');
  function deanoinsertdata() {
  /**
   * Dean-O database insert book function
  */
  global $wpdb;
  if(isset($_POST['submitbtn'])){
      error_log('I am here');     
      $data=array(
          'wp_id'=&gt;$_POST['wp_id'],
          'title'=&gt;$_POST['title'],
          'author'=&gt;$_POST['author'],
      );
      $table_name = 'books';
      $foundOne = 1;
      error_log('table_name = '.$table_name);
      error_log('foundOne = '.$foundOne);
  
  
      /*$wp_idin = $_POST['wp_id'];
      $titlein = $_POST['title'];
      $authorin = $_POST['author'];
      */
      $wp_idin = $data['wp_id'];
      $titlein = $data['title'];
      $authorin = $data['author'];
  
      error_log('wp_idin = '.$wp_idin);
      error_log('titlein = '.$titlein);
      error_log('author = '.$authorin);
      
  
      /*
      see if the record is already in the table
      */
      $sql = &quot;select * from books&quot;; 
      print $sql;
      $results = $wpdb-&gt;get_results($sql);
      foreach($results as $result) {
          if($result-&gt;wp_id==$wp_idin &amp;&amp; $result-&gt;title==$titlein &amp;&amp; $result-&gt;author==$authorin)
          {
              $foundOne = 0;
              error_log('foundOne = 0');
          }
      }
      //error_log('logged message');
  
      
  
      if($foundOne==1) {
          error_log('foundOne = 1 before insert');
          $resultinsert = $wpdb-&gt;insert($table_name,$data);//, $format=NULL);
          error_log('insert executed');
          error_log('resultinsert = '.$resultinsert);
          //wp_redirect( &quot;http://localhost/tadpolewp/deano-plugin--duplicate-records/&quot; );
          //exit();
          if($resultinsert==1) {
               //header('Location: http://localhost/tadpolewp/deano-plugin-successful/'); 
              error_log( 'successful' );
               wp_redirect( &quot;http://localhost/tadpolewp/deano-plugin-successful/&quot; );
               exit();
               http://localhost/tadpolewp/deano-plugin-successful/
              //error_log('Book saved 1');
              //echo &quot;Book Saved 1&quot;;
          } else {
              //header('Location: http://localhost/tadpolewp/deano-plugin-failed/'); 
              error_log( 'failed to save' );
              wp_redirect( &quot;http://localhost/tadpolewp/deano-plugin-failed/&quot; );
              exit();
              //error_log('unable to save');
              //echo &quot;Unable to Save&quot;;
          }
      } else {
          //error_log('Duplicate record found');
          //echo &quot;Duplicate recortd found&quot;;
          //header('Location: http://localhost/tadpolewp/deano-plugin-duplicate-records/');
          error_log( 'duplicate record' );
          wp_redirect( &quot;http://localhost/tadpolewp/deano-plugin-duplicate-records/&quot; );
          exit();
  
      }
  
      
  
      
  
   }
  ?&gt;
  &lt;form role=&quot;form&quot; method=&quot;post&quot;&gt;
                  &lt;div class=&quot;form-group&quot;&gt;
                        &lt;?php
                  // get current user ID, with default value, if empty
                  $current_user_id = get_current_user_id();
              ?&gt;
  
                      &lt;input type=&quot;hidden&quot; name=&quot;wp_id&quot; value=&quot;&lt;?php echo esc_attr( $current_user_id ); ?&gt;&quot; /&gt;
                  &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
      &lt;label&gt;Field 1&lt;/label&gt;&lt;br&gt;
      &lt;input id=&quot;title&quot; name=&quot;title&quot; type=&quot;text&quot; placeholder=&quot;&lt;?php echo esc_attr( $current_user_id ); ?&gt;&quot;  required=&quot;&quot;&gt;
  &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
      &lt;label&gt;Field 2&lt;/label&gt;&lt;br&gt;
      &lt;input id=&quot;author&quot; name=&quot;author&quot; type=&quot;text&quot; placeholder=&quot;Primary Author&quot;  required=&quot;&quot;&gt;
  &lt;/div&gt;
  &lt;div class=&quot;row justify-content-center&quot;&gt;
      &lt;div class=&quot;col-xs-4 col-sm-4 col-md-4&quot;&gt;
          &lt;br&gt;&lt;input type=&quot;submit&quot; value=&quot;Submit1&quot; class=&quot;btn btn-info btn-block&quot; name=&quot;submitbtn&quot;&gt;
      &lt;/div&gt;
   &lt;/div&gt;
  &lt;/form&gt;
  
  
  &lt;?php
  }
  add_shortcode('deanoputdatain','deanoinsertdata');
  
  
  ?&gt;
  </code></pre>
  <p>The only way I can get the Field 1 or Field 2 to take numbers is to change them to type=&quot;number&quot;</p>
  <p>Is there a varchar type that I can use?</p>
  <p>My database has the field set as a varchar.</p>
  <p>Thanks in advance
  Dean-O</p>