title: PHP undefined index id error
body: <p>I am trying to submit this form and upon the submission it should redirect to itself back. However, the problem I am facing is that, after I submit the form it display this error:</p>
  
  <pre><code>Notice: Undefined index: id in C:\xampp\htdocs\iNetLink\configuration.php on line 9
  </code></pre>
  
  <p>Here is my form file:</p>
  
  <pre><code>    &lt;?php include("header.php");
  
  if(ISSET($_POST['node'])){
    $nodeID = $_POST['node'];
  }else{
    $nodeID = 0;
  }
  
  $requestID = $_GET['id'];
  $qConfigurationForm = "SELECT * FROM configuration WHERE request_id = '$requestID' ";
  $rConfigurationForm = $connection-&gt;query($qConfigurationForm);
  
  $rowCount = $rConfigurationForm-&gt;rowCount();
  $row = $rConfigurationForm-&gt;fetch();
  
  if($rowCount &gt; 0){
  ?&gt;
  &lt;section id="content"&gt;
    &lt;section class="vbox"&gt;
      &lt;section class="scrollable padder"&gt;
  
        &lt;ul class="breadcrumb no-border no-radius b-b b-light pull-in"&gt;
          &lt;li&gt;&lt;a href="index.html"&gt;&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
        &lt;div class="m-b-md"&gt;
          &lt;h3 class="m-b-none"&gt;Configuration&lt;/h3&gt;
        &lt;/div&gt;
        &lt;section class="panel panel-default"&gt;
        &lt;!-- Tabs for navigation --&gt;
          &lt;?php include("tabs.php");?&gt;
        &lt;/section&gt;
        &lt;!-- Tabs for navigation ended --&gt;
  
        &lt;!--forms--&gt;
        &lt;section class="panel panel-default"&gt;
            &lt;header class="panel-heading font-bold"&gt;Line Configuration Information&lt;/header&gt;
            &lt;div class="panel-body"&gt;
            &lt;form class="form-horizontal" method="post" action="configuration.php" data-validate="parsley"&gt;
            &lt;div class="col-md-6"&gt;
            &lt;div class="form-group"&gt;
              &lt;label class="col-sm-3 control-label" for="requestID"&gt;&lt;/label&gt;
                &lt;div class="col-sm-6"&gt;
                    &lt;input type="hidden" name="requestID" id="requestID" value="&lt;?php echo $requestID;?&gt;"&gt;
                    &lt;input type="hidden" name="isUpdate" value="1" /&gt;
                &lt;/div&gt;
            &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label class="col-sm-3 control-label"&gt;Node&lt;/label&gt;
                    &lt;div class="col-sm-6"&gt;
                    &lt;select name="node" id="node" class="form-control m-b" onchange="GetId()" data-required="true"&gt;
                    &lt;option&gt;&lt;/option&gt;
                    &lt;?php
  
                      $qNode = "SELECT id,node FROM node WHERE id = '$nodeID'";
                      $rNode = $connection-&gt;query($qNode);
  
                      foreach($rNode as $node){
                      $nodeid = $node['id'];
                      $nodeName = $node['node'];
  
                      echo "&lt;option value=\"$nodeid\" selected=\"selected\"&gt;$nodeName&lt;/option&gt;";
                      }
                      echo "&lt;optgroup&gt;&lt;/optgroup&gt;";
  
                      $qNode = "SELECT id,node FROM node WHERE `status` = 1";
                      $rNode = $connection-&gt;query($qNode);
  
                      foreach($rNode as $node){
                      $nodeid = $node['id'];
                      $nodeName = $node['node'];
  
                      echo "&lt;option value=\"$nodeid\"&gt;$nodeName&lt;/option&gt;";
                      }
                    ?&gt;
                    &lt;/select&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label class="col-sm-3 control-label"&gt;Connection Type&lt;/label&gt;
                    &lt;div class="col-sm-6"&gt;
                      &lt;select name="connectionType" id="connectionType" class="form-control m-b" data-required="true"&gt;
                        &lt;option&gt;&lt;/option&gt;
                        &lt;?php
  
                            $connection_type = $row['connection_type'];
  
                            $qConnectionConfigType = "SELECT * FROM `connection_type_config` WHERE id = '$connection_type'";
                            $rConnectionConfigType = $connection-&gt;query($qConnectionConfigType);
  
                            foreach($rConnectionConfigType as $connectionConfigType){
                              $connectionConfigID = $connectionConfigType['id'];
                              $connectionType = $connectionConfigType['connection_type'];
  
                              echo "&lt;option value=\"$connectionConfigID\" selected=\"selected\"&gt;$connectionType&lt;/option&gt;";
                              }
                              echo "&lt;optgroup&gt;&lt;/optgroup&gt;";
  
                              $qConnectionConfigType = "SELECT * FROM `connection_type_config`";
                              $rConnectionConfigType = $connection-&gt;query($qConnectionConfigType);
  
                              foreach($rConnectionConfigType as $connectionConfigType){
                                $connectionConfigID = $connectionConfigType['id'];
                                $connectionType = $connectionConfigType['connection_type'];
  
                                echo "&lt;option value=\"$connectionConfigID\"&gt;$connectionType&lt;/option&gt;";
                              }
                           ?&gt;
                      &lt;/select&gt;
                    &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label class="col-sm-3 control-label" for="timeSlot"&gt;Time Slot&lt;/label&gt;
                  &lt;div class="col-sm-6"&gt;
                    &lt;input type="text" class="form-control" id="timeSlot" name="timeSlot" value="&lt;?php echo $row['time_slot'];?&gt;" data-required="true"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label class="col-sm-3 control-label" for="dslUnifiNo"&gt;DSL/Unifi Username&lt;/label&gt;
                  &lt;div class="col-sm-6"&gt;
                    &lt;input type="text" class="form-control" id="dslUnifiNo" name="dslUnifiNo" value="&lt;?php echo $row['dsl_username'];?&gt;"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label class="col-sm-3 control-label" for="remarksConfig"&gt;Remarks&lt;/label&gt;
                  &lt;div class="col-sm-6"&gt;
                  &lt;textarea rows="4" cols="50" class="form-control" id="remarksConfig" name="remarksConfig"&gt;&lt;?php echo $row['remarks'];?&gt;&lt;/textarea&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
            &lt;div class="col-md-6"&gt;
  
            &lt;div class="form-group"&gt;
                  &lt;label class="col-sm-3 control-label"&gt;Port&lt;/label&gt;
                    &lt;div class="col-sm-6"&gt;
                    &lt;select name="portNo" id="portNo" name="portNo" class="form-control m-b" data-required="true"&gt;
                    &lt;!-- &lt;option&gt;&lt;/option&gt;
                    &lt;?php
  
                      $qPortNo = "SELECT * FROM node_port WHERE node_id = '$nodeID' AND `status` = 1";
                      $rPortNo = $connection-&gt;query($qPortNo);
  
                      foreach($rPortNo as $portNo){
                      $portID = $portNo['id'];
                      $number = $portNo['port_no'];
  
                      echo "&lt;option value=\"$portID\"&gt;$number&lt;/option&gt;";
                      }
                    ?&gt; --&gt;
                    &lt;/select&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label class="col-sm-3 control-label"&gt;E1 Circuit No.&lt;/label&gt;
                    &lt;div class="col-sm-6"&gt;
                      &lt;select name="e1circuitNo" id="e1circuitNo" class="form-control m-b"&gt;
                        &lt;option&gt;&lt;/option&gt;
                        &lt;?php
                              $e1_circuit_no = $row['e1_curcuit_no'];
  
                              $qE1Type = "SELECT * FROM `e1_type` WHERE id = '$e1_circuit_no'";
                              $rE1Type = $connection-&gt;query($qE1Type);
  
                              foreach($rE1Type as $e1Type){
                                $e1ID = $e1Type['id'];
                                $type = $e1Type['type'];
  
                                echo "&lt;option value=\"$e1ID\" selected=\"selected\"&gt;$type&lt;/option&gt;";
                              }
                              echo "&lt;optgroup&gt;&lt;/optgroup&gt;";
  
                              $qE1Type = "SELECT * FROM `e1_type`";
                              $rE1Type = $connection-&gt;query($qE1Type);
  
                              foreach($rE1Type as $e1Type){
                                $e1ID = $e1Type['id'];
                                $type = $e1Type['type'];
  
                                echo "&lt;option value=\"$e1ID\"&gt;$type&lt;/option&gt;";
                              }
                           ?&gt;
                      &lt;/select&gt;
                    &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                &lt;label class="col-sm-3 control-label"&gt;Changed Date&lt;/label&gt;
                &lt;div class="col-sm-6"&gt;
                  &lt;input class="input-m input-m form-control" type="date" 
                  data-date-format="dd-mm-yyyy" id="changedDate" name="changedDate" value="&lt;?php echo $row['changed_date'];?&gt;" data-required="true"&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label class="col-sm-3 control-label" for="dslUnifiIp"&gt;DSL/Unifi IP&lt;/label&gt;
                  &lt;div class="col-sm-6"&gt;
                    &lt;input type="text" class="form-control" id="dslUnifiIp" name="dslUnifiIp" value="&lt;?php echo $row['dsl_ip'];?&gt;"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;br/&gt;
                &lt;div class="btn-toolbar pull-right"&gt;
                &lt;input type="hidden" name="id" value="&lt;?=$requestID;?&gt;"&gt;
                &lt;input class="btn btn-warning " type="reset" value="Reset" name="reset" &gt;
                &lt;input class="btn btn-info " type="submit" value="Save Draft" name="saveDraft"&gt;
                &lt;input class="btn btn-success " type="submit" value="Submit" name="Submit"&gt;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;/form&gt;
            &lt;/div&gt;
        &lt;/section&gt;
  </code></pre>
  
  <p>Line 9 is the <code>$requestID = $_GET['id'];</code></p>
  
  <p>Here is the executer for the form:</p>
  
  <pre><code>    &lt;?php
  include("dbconnection.php");
  session_start();
  /* 
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  $requesterID = $_SESSION['id'];
  print_r($_POST);
  $node = $_POST['node'];
  $connectionType = $_POST['connectionType'];
  $timeSlot = $_POST['timeSlot'];
  $dslUnifiNo = $_POST['dslUnifiNo'];
  $remarksConfig = $_POST['remarksConfig'];
  $port = $_POST['port'];
  $e1circuitNo = $_POST['e1circuitNo'];
  $changedDate = $_POST['changedDate'];
  $dslUnifiIp = $_POST['dslUnifiIp'];
  $requestID = $_POST['requestID'];
  
  
  if(ISSET($_POST['isUpdate'])){
      $qinsert = "UPDATE configuration SET
              node = '$node',
              connection_type = '$connectionType',
              time_slot = '$timeSlot',
              dsl_username = '$dslUnifiNo',
              remarks = '$remarksConfig',
              port = '$port',
              e1_curcuit_no = '$e1circuitNo',
              changed_date = '$changedDate',
              dsl_ip = '$dslUnifiIp'
              WHERE request_id = '$requestID'";
  }else
  {
      $qinsert = "REPLACE INTO configuration SET
              node = '$node',
              connection_type = '$connectionType',
              time_slot = '$timeSlot',
              dsl_username = '$dslUnifiNo',
              remarks = '$remarksConfig',
              port = '$port',
              e1_curcuit_no = '$e1circuitNo',
              changed_date = '$changedDate',
              dsl_ip = '$dslUnifiIp',
              request_id = '$requestID'";
  
              $requestID = $connection-&gt;lastInsertId();
              if($status == 1){
                  $action = "lineApplication.php";
                  $dateCreated = date("Y-m-d H:i:s");
                  $userTypeID = 5;
  
                  $qinsertTss = "INSERT INTO notifications SET
                                  user_id = '$requesterID',
                                  action = '$action',
                                  item_id = '$requestID',
                                  created_at = '$dateCreated',
                                  receive_user_type_id = '$userTypeID'";
  
                  $rinsertTss = $connection-&gt;query($qinsertTss);
              }
  }
  $rinsert = $connection-&gt;query($qinsert);
  
  header("location:configuration.php?id=$requestID");
  </code></pre>
  
  <p>Help! :)</p>