php - i want to strore multiple values in database but storing only one value -


 <div class="row" id="related_campaigns">     <div class="span6">             <div class="control-group">     <label class="control-label" for="inputgaveabonnement">     campaign<b>*</b>     </label>     <div class="controls">       <div class="fieldrow_horz1">         <div class="fieldgroup">           <label>            name <b>*</b>           </label>         </div>         <div class="fieldgroup">           <label>             image <b>*</b>           </label>         </div>          <div class="fieldgroup">           <label>             url <b>*</b>           </label>         </div>       </div>     </div>       <?php      // save array can loop out later =)              $result = db2_getrelcamp( array('campaigns_id' => $this_id) );              if (!is_null($result))             {       $numsub1 = 0;                 while ( $row = $result->fetch_object() )                   {         $numsub1 = $numsub1 +1;         array_push($arrcampaignname, $row->campaignname);         array_push($arrcampaignimage, $row->campaignimage);         array_push($arrcampaignurl, $row->campaignurl);                 }       $formcountfld1=$numsub1;             }     else     {     $numsub1=1;     $formcountfld1=1;     }      $i = 1;      if (1==1) {          ($i = 1; $i <= $numsub1; $i++) {     ?>       <div class="fieldrow_horz1">          <div class="fieldgroup">           <input type="text" id="campaignname_<?= $i ?>" name="campaignname_<?= $i ?>" value="<?= isset($arrcampaignname[$i-1]) ? $arrcampaignname[$i-1] : '' ?>" />         </div>          <div class="fieldgroup">              <select  id="campaignimage_<?= $i ?>" name="campaignimage_<?= $i ?>" alue="<?= isset($arrcampaignimage[$i-1]) ? $arrcampaignimage[$i-1] : '' ?>" />                 <?php                     // * hæmta alla filer mappen                     $dir = "../images/campaigns/";                     $files = scandir($dir);                     $strselected = "";                     $somethingchecked = false;                      foreach($files $key => $value)                     {                         if ($value != '.' && $value != '..')                         {                             if ( $formimage === $value ) {                                 $strselected = ' selected="selected"';                                 $somethingchecked = true;                             } else                                 $strselected = '';                              echo '<option value="' . $value . '"' . $strselected . '>' . $value . '</option>';                         }                     }                 ?>                 <?php                     if ($somethingchecked) {                         $strselected = '';                     } else {                         $strselected = ' selected="selected"';                     }                     echo "<option disabled='disabled'></option>";                     echo '<option value=""' . $strselected .'>- ikke bruk bilde -</option>';                 ?>                 </select>                  <p class="help-block">a related image campaign image archive (<a href="image.php" target="_blank">upload</a>).</p>          </div>            <div class="fieldgroup">    <input type="text" id="campaignurl_<?= $i ?>" name="campaignurl_<?= $i ?>" value="<?= isset($arrcampaignurl[$i-1]) ? $arrcampaignurl[$i-1] : '' ?>" />          </div>  <img src="../images/remove.png" alt="delete"  class="link" id="remove_<?= $i ?>"  />        </div>  <?php /*?>value="<?= isset($arretternavn[$i-1]) ? $arretternavn[$i-1] : '' ?>" <?php value="<?= $arretternavn[$i-1] ?>" */?>          <?php                  }          } else {      ?>        <div class="fieldrow_horz1" >          <div class="fieldgroup">           <input type="text" id="campaignname_<?= $i ?>" name="campaignname_<?= $i ?>" value="" />         </div>          <div class="fieldgroup">              <select  id="campaignimage_<?= $i ?>" name="campaignimage_<?= $i ?>" class="span3" >                 <?php                     // * hæmta alla filer mappen                     $dir = "../images/campaigns/";                     $files = scandir($dir);                     $strselected = "";                     $somethingchecked = false;                      foreach($files $key => $value)                     {                         if ($value != '.' && $value != '..')                         {                             if ( $formimage === $value ) {                                 $strselected = ' selected="selected"';                                 $somethingchecked = true;                             } else                                 $strselected = '';                              echo '<option value="' . $value . '"' . $strselected . '>' . $value . '</option>';                         }                     }                 ?>                 <?php                     if ($somethingchecked) {                         $strselected = '';                     } else {                         $strselected = ' selected="selected"';                     }                     echo "<option disabled='disabled'></option>";                     echo '<option value=""' . $strselected .'>- ikke bruk bilde -</option>';                 ?>                 </select>                  <p class="help-block">a realated image campaign image archive (<a href="image.php" target="_blank">upload</a>).</p>         </div>               <div class="fieldgroup">           <input type="text" id="campaignurl_<?= $i ?>" name="campaignurl_<?= $i ?>" value="" />         </div>        </div>        <?php          }      ?>          <?php                 $thisid = "countfld1";                 $thisvar = $formcountfld1; ?>        <input type="hidden" name="<?= strtolower($thisid) ?>" class="input-medium" id="input<?= $thisid ?>" value="<?= htmlspecialchars($thisvar, ent_quotes) ?>" />        <p class="leggtil1">          <a href="#"  id="linkadd1">+ legg til flere</a>        </p>       </div>     </div>     </div> 

i want store multiple aticle values in database title ,image , url itis storing 1 value in db suggestion .thanks in advance

look @ documentation

serialize(); unserialize(); 

they encode , decode, array or object specific text based encoded string, little json, not json.

they used over, @ wordpress database example.

serialize()

unserialize()


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -