title: pg_query Query failed: ERROR invalid input syntax for integer
body: <p>Get the error message on submit.</p>
  
  <blockquote>
    <p>Warning: pg_query(): Query failed: ERROR: invalid input syntax for
    integer: "2018-03-11" LINE 1: INSERT INTO feedback2 VALUES
    ('2018-03-11', '1', '1','1','1'... ^ in
    /var/www/html/form/feedback.php on line 37</p>
  </blockquote>
  
  <p>When loading the page I see the following</p>
  
  <blockquote>
    <p>Warning: pg_query(): Query failed: ERROR: invalid input syntax for
    integer: "" LINE 1: INSERT INTO feedback2 VALUES ('', '', '','','',
    '', '', '') ^ in /var/www/html/form/feedback.php on line 37</p>
  </blockquote>
  
  <p>What have I done wrong?????</p>
  
  <p>DB creation</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS public.feedback2
  (
    idx integer NOT NULL,
    date date,
    location character varying,
    course character varying,
    trainer character varying,
    trainer_expertise integer,
    trainer_presentation integer,
    trainer_understanding integer,
    trainer_welcome integer
  
  )
  WITH (
    OIDS=FALSE
  );
  ALTER TABLE public.feedback2
    OWNER TO postgres;
  
  HTML/PHP is
  
  
  
     &lt;!DOCTYPE html&gt;
  &lt;head&gt;
  &lt;title&gt;Enter Student Feedback&lt;/title&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;style&gt;
  li {listt-style: none;}
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h2&gt;Enter Student Feedback&lt;/h2&gt;
  &lt;ul&gt;
  &lt;form name="feedback" action="feedback.php" method="POST" &gt;
  &lt;li&gt;Date:&lt;/li&gt;&lt;li&gt;&lt;input type="date" name="date"&gt;&lt;/li&gt;
  
  &lt;li&gt;Location:&lt;/li&gt;
          &lt;li&gt;&lt;select name="location"&gt;&lt;option value=''&gt;&lt;/option&gt;&lt;option value="1"&gt;UK&lt;/option&gt;&lt;option value="2"&gt;NG&lt;/option&gt;&lt;option value="3"&gt;SA&lt;/option&gt;&lt;option value="4"&gt;KE&lt;/option&gt;&lt;option value="5"&gt;Onsite&lt;/option&gt;&lt;/select&gt;&lt;/li&gt;
  &lt;li&gt;Course Name:&lt;/li&gt;
          &lt;li&gt;&lt;select name="course"&gt;&lt;option value=''&gt;&lt;/option&gt;&lt;option value="1"&gt;INST-ZFS&lt;/option&gt;&lt;option value="2"&gt;INST-RC&lt;/option&gt;&lt;option value="3"&gt;ENG-ZFS&lt;/option&gt;&lt;option value="4"&gt;ENG-RC&lt;/option&gt;&lt;option value="5"&gt;NMS-OP&lt;/option&gt;&lt;option value="6"&gt;NMS-ADM&lt;/option&gt;&lt;/select&gt;&lt;/li&gt;
  &lt;li&gt;Trainer:&lt;/li&gt;
          &lt;li&gt;&lt;select name="trainer"&gt;&lt;option value=''&gt;&lt;/option&gt;&lt;option value="1"&gt;RSP&lt;/option&gt;&lt;option value="2"&gt;DN&lt;/option&gt;&lt;option value="3"&gt;ANO&lt;/option&gt;&lt;option value="4"&gt;JO&lt;/option&gt;&lt;option value="5"&gt;GN&lt;/option&gt;&lt;/select&gt;&lt;/li&gt;
  &lt;li&gt;Trainer Expertise:&lt;/li&gt;
            &lt;input type="radio" name="trainer_expertise" value="1"&gt;1&lt;input type="radio" name="trainer_expertise" value="1"&gt;2&lt;input type="radio" name="trainer_expertise" value="1"&gt;3&lt;input type="radio" name="trainer_expertise" value="1"&gt;4&lt;input type="radio" name="trainer_expertise" value="1"&gt;5&lt;input type="radio" name="trainer_expertise" value="1"&gt;6
  &lt;li&gt;Trainer Presentation:&lt;/li&gt;
          &lt;input type="radio" name="trainer_presentation" value="1"&gt;1&lt;input type="radio" name="trainer_presentation" value="1"&gt;2&lt;input type="radio" name="trainer_presentation" value="1"&gt;3&lt;input type="radio" name="trainer_presentation" value="1"&gt;4&lt;input type="radio" name="trainer_presentation" value="1"&gt;5&lt;input type="radio" name="trainer_presentation" value="1"&gt;6
  &lt;li&gt;Trainer Understanding:&lt;/li&gt;
          &lt;input type="radio" name="trainer_understanding" value="1"&gt;1&lt;input type="radio" name="trainer_understanding" value="1"&gt;2&lt;input type="radio" name="trainer_understanding" value="1"&gt;3&lt;input type="radio" name="trainer_understanding" value="1"&gt;4&lt;input type="radio" name="trainer_understanding" value="1"&gt;5&lt;input type="radio" name="trainer_understanding" value="1"&gt;6
  &lt;li&gt;Trainer Welcome:&lt;/li&gt;
            &lt;input type="radio" name="trainer_welcome" value="1"&gt;1&lt;input type="radio" name="trainer_welcome" value="1"&gt;2&lt;input type="radio" name="trainer_welcome" value="1"&gt;3&lt;input type="radio" name="trainer_welcome" value="1"&gt;4&lt;input type="radio" name="trainer_welcome" value="1"&gt;5&lt;input type="radio" name="trainer_welcome" value="1"&gt;6
  &lt;li&gt;&lt;input type="submit" /&gt;&lt;/li&gt;
  &lt;/form&gt;
  &lt;/ul&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php
  $db = pg_connect("host=localhost port=5432 dbname=training user=postgres password=training");
  $query = "INSERT INTO feedback2 VALUES ('$_POST[date]', '$_POST[location]', '$_POST[course]','$_POST[trainer]','$_POST[trainer_expertise]', '$_POST[trainer_presentation]', '$_POST[trainer_understanding]', '$_POST[trainer_welcome]')";
  $result = pg_query($query);
  ?&gt;
  </code></pre>