title: How To Store Span Value To Database
body: <p>I have a table where there are products in each row one product and its specifications and there is a checkbook
  When I select a specific row and press the update button, I will be taken to the edit page
  Which takes the values ​​and puts them in textboxes to enable me to modify any data
  But I faced a problem in organizing the inputs and I found that Span is the best and most organized way to display the data and adapt to the length and width of the cell in the table, and the problem is that the value of the span when I edit it’s never saved to the database.
  I have tried over and over to find a solution in saving the span value to the database but nothing worked with me.
  Through <code>&lt;input type=“text”&gt;</code> it is going well but not organized in the presentation.</p>
  <p><strong>This is what I have :</strong></p>
  <pre><code>&lt;?php
  require_once &quot;connection.php&quot;;
  extract($_POST);
  if(isset($_POST[&quot;submit&quot;]) &amp;&amp; $_POST[&quot;submit&quot;]!=&quot;&quot;) {
  $membersCount = count($_POST[&quot;Dprogress&quot;]);
  for($i=0;$i&lt;$membersCount;$i++) {
      $connection2 = mysqli_connect('localhost', 'root','','zaed');
  $query2 = &quot;UPDATE newinstockd set Dprogress='&quot; . $_POST[&quot;Dprogress&quot;][$i] . &quot;', Dcategory='&quot; . $_POST[&quot;Dcategory&quot;][$i] . &quot;', DQ='&quot; . $_POST[&quot;DQ&quot;][$i] . &quot;', Dstatus='&quot; . $_POST[&quot;Dstatus&quot;][$i] . &quot;', Ddesc='&quot; . $_POST[&quot;Ddesc&quot;][$i] . &quot;',Address='&quot; . $_POST[&quot;Address&quot;][$i] . &quot;', Pnumber='&quot; . $_POST[&quot;Pnumber&quot;][$i] . &quot;', Donorname='&quot; . $_POST[&quot;Donorname&quot;][$i] . &quot;', Daytopickup='&quot; . $_POST[&quot;Daytopickup&quot;][$i] . &quot;', Timetopickup='&quot; . $_POST[&quot;Timetopickup&quot;][$i] . &quot;', Pickdrivername='&quot; . $_POST[&quot;Pickdrivername&quot;][$i] . &quot;', pickdrivernumber='&quot; . $_POST[&quot;pickdrivernumber&quot;][$i] . &quot;' WHERE DID='&quot; . $_POST[&quot;DID&quot;][$i] . &quot;'&quot;;
  $result2 = mysqli_query($connection2, $query2);
  }
  
  header(&quot;Location:newinstock.php&quot;);
  }
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Edit Members&lt;/title&gt;
  &lt;style&gt;
  html, body {
        min-height: 100%;
        }
        body, div, form, input, select, p { 
        padding: 0;
        margin: 0;
        outline: none;
        font-family: Roboto, Arial, sans-serif;
        font-size: 14px;
        color: #666;
        line-height: 22px;
        }
        h1 {
        position: absolute;
        margin: 0;
        font-size: 32px;
        color: #fff;
        z-index: 2;
        }
        h2 {
        font-weight: 400;
        }
        .testbox {
        display: flex;
        justify-content: left;
        align-items: center;
        height: inherit;
        padding-left: 300px;
        }
        form {
        width: 50%;
        padding: 20px;
        border-radius: 6px;
        background: #fff;
        box-shadow: 0 0 20px 0 #095484; 
        }
        .banner {
        position: relative;
        height: 210px;
        background-image: url(&quot;/uploads/media/default/0001/01/3f0d2969f2cffeb123ab1a6fa7408bf87bd34bd3.jpeg&quot;);  
        background-size:cover;
        display: flex;
        justify-content:center;
        align-items: center;
        text-align: center;
        }
        .banner::after {
        content: &quot;&quot;;
        background-color: rgba(85, 0, 0, 0.4); 
        position: absolute;
        width: 100%;
        height: 100%;
        }
        input, select {
        margin-bottom: 10px;
        border: 1px solid #ccc;
        border-radius: 3px;
        }
        input {
        width: calc(100% - 10px);
        padding: 5px;
        }
        select {
        width: 100%;
        padding: 7px 0;
        background: transparent;
        }
        .item:hover p, .item:hover i, .question:hover p, .question label:hover, input:hover::placeholder, a {
        color: #095484;
        }
        .item input:hover, .item select:hover {
        border: 1px solid transparent;
        box-shadow: 0 0 6px 0 #095484;
        color: #095484;
        }
        .item {
        position: relative;
        margin: 10px 0;
        }
        input[type=&quot;date&quot;]::-webkit-inner-spin-button {
        display: none;
        }
        .item i, input[type=&quot;date&quot;]::-webkit-calendar-picker-indicator {
        position: absolute;
        font-size: 20px;
        color: #a9a9a9;
        }
        .item i {
        right: 2%;
        top: 30px;
        z-index: 1;
        }
        [type=&quot;date&quot;]::-webkit-calendar-picker-indicator {
        right: 1%;
        z-index: 2;
        opacity: 0;
        cursor: pointer;
        }
        input[type=checkbox]  {
        display: none;
        }
        label.check {
        position: relative;
        display: inline-block;
        margin: 5px 20px 10px 0;
        cursor: pointer;
        }
        .question span {
        margin-left: 30px;
        }
        span.  {
        margin-left: 0;
        color: red;
        }
        label.check:before {
        content: &quot;&quot;;
        position: absolute;
        top: 2px;
        left: 0;
        width: 16px;
        height: 16px;
        border-radius: 2px;
        border: 1px solid #095484;
        }
        input[type=checkbox]:checked + .check:before {
        background: #095484;
        }
        label.check:after {
        content: &quot;&quot;;
        position: absolute;
        top: 6px;
        left: 4px;
        width: 8px;
        height: 4px;
        border: 3px solid #fff;
        border-top: none;
        border-right: none;
        transform: rotate(-45deg);
        opacity: 0;
        }
        input[type=checkbox]:checked + label:after {
        opacity: 1;
        }
        .btn-block {
        margin-top: 10px;
        text-align: center;
        }
        button {
        width: 150px;
        padding: 10px;
        border: none;
        border-radius: 5px; 
        background: #095484;
        font-size: 16px;
        color: #fff;
        cursor: pointer;
        }
        button:hover {
        background: #0666a3;
        }
        @media (min-width: 568px) {
        .name-item, .city-item {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        }
        .name-item input, .city-item input {
        width: calc(50% - 20px);
        }
        .city-item select {
        width: calc(50% - 8px);
        }
        }
         span.required {
        margin-left: 0;
        color: red;
        }
        
        
        
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form name=&quot;frmUser&quot; method=&quot;post&quot; action=&quot;&quot; align=&quot;left&quot; style=&quot;width:1500px;&quot;&gt;
  
  &lt;div  align=&quot;left&quot;&gt;
  
  &lt;?php
  $count = count($_POST[&quot;DID&quot;]);
  for($i=0;$i&lt;$count;$i++) {
      
  try{
  require_once &quot;connection.php&quot;;
  extract($_POST);
  $connection = mysqli_connect('localhost', 'root','','zaed');
  $query = &quot;SELECT * FROM newinstockd WHERE DID='&quot; . $_POST[&quot;DID&quot;][$i] . &quot;'&quot;;
  $result = mysqli_query($connection, $query);
  $row[$i]= mysqli_fetch_array($result);
  }
  
  catch(PDOException $ex) {
      die (&quot;Error Message &quot;.$ex-&gt;getMessage());
  }   
  ?&gt;
  
  
  &lt;table border=&quot;.05&quot; align=&quot;left&quot; class=&quot;tblListForm&quot;  border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;2&quot;  &gt;
  
  
     &lt;tr class=&quot;head&quot;&gt;
   &lt;thead class=&quot;thead-dark&quot;&gt;
      &lt;tr&gt;
        &lt;th scope=&quot;col&quot; width='5%'&gt;ID&lt;/th&gt;
      &lt;th scope=&quot;col&quot;&gt;Donation Progres&lt;/th&gt;
      &lt;th scope=&quot;col&quot;&gt;Category&lt;/th&gt;
      &lt;th scope=&quot;col&quot; &gt;Q&lt;/th&gt;
      &lt;th scope=&quot;col&quot;&gt;Stutus&lt;/th&gt;
      &lt;th scope=&quot;col&quot; width='15%'&gt;Discription&lt;/th&gt;
      &lt;th scope=&quot;col&quot; width='15%'&gt;Address&lt;/th&gt;
      &lt;th scope=&quot;col&quot;&gt;Phone&lt;/th&gt;
      &lt;th scope=&quot;col&quot;&gt;Donor Name&lt;/th&gt;
      &lt;th scope=&quot;col&quot; width='10%'&gt;Day To Pick Up&lt;/th&gt;
      &lt;th scope=&quot;col&quot; width='10%'&gt;Time To Pick Up&lt;/th&gt;
      &lt;th scope=&quot;col&quot; width='7.5%'&gt;pick up driver name&lt;/th&gt;
      &lt;th scope=&quot;col&quot; width='7.5%'&gt;pick up driver Number&lt;/th&gt;
      
      &lt;/tr&gt;
    &lt;/thead&gt;
  &lt;/tr&gt;
    
  
  &lt;tr class=&quot;rows&quot;&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; style=&quot;width: 100%; height: 100%;&quot; name=&quot;DID[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['DID']; ?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Dprogress[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['Dprogress']; ?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Dcategory[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['Dcategory']; ?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;DQ[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['DQ']; ?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Dstatus[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['Dstatus']; ?&gt;&quot;&gt;&lt;/td&gt;
  
  
  
  &lt;td &gt;&lt;span class=&quot;txtField&quot; name=&quot;Ddesc[]&quot; value=&quot;&lt;?php echo $row[$i]['Ddesc']; ?&gt;&quot; role=&quot;textbox&quot; contenteditable&gt;&lt;/span&gt;&lt;/td&gt;
  
  
  
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Address[]&quot; class=&quot;txtField&quot; value=&quot; &lt;?php echo $row[$i]['Address']; ?&gt;&quot; &gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Pnumber[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['Pnumber']; ?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Donorname[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['Donorname']; ?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Daytopickup[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['Daytopickup']; ?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Timetopickup[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['Timetopickup']; ?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Pickdrivername[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['Pickdrivername']; ?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;pickdrivernumber[]&quot; class=&quot;txtField&quot; value=&quot;&lt;?php echo $row[$i]['pickdrivernumber']; ?&gt;&quot;&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;/table&gt;
  
  &lt;?php
  }
  ?&gt;
  
  &lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit&quot; class=&quot;btnSubmit&quot;&gt;
  
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>