第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我想在多列但同一個表中插入多個復選框值

我想在多列但同一個表中插入多個復選框值

PHP
拉風的咖菲貓 2021-06-29 05:46:53
我的代碼將多個選定的值插入到兩列中,但兩列都包含第一個列出(選定)復選框的值。例如。如果我選擇了 .Net2 和 Java3,兩個 cloumns 將受到影響,但它們的值都為 2。<form action="" method="post" >     <div style="width:200px;border-radius:6px;margin:0px auto">  <table border="1">     <tr>        <td colspan="2">Select Technolgy:</td>     </tr>     <tr>        <td>PHP1</td>        <td><input type="checkbox" name="techno[]" value="1"></td>     </tr>     <tr>        <td>.Net2</td>        <td><input type="checkbox" name="techno[]" value="2"></td>     </tr>     <tr>        <td>Java3</td>        <td><input type="checkbox" name="techno[]" value="3"></td>     </tr>     <tr>        <td>Javascript4</td>        <td><input type="checkbox" name="techno[]" value="4"></td>     </tr>     <tr>        <td colspan="2" align="center"><input type="submit" value="submit" name="sub"></td>     </tr>  </table>  </div>  </form>  <?php  if(isset($_POST['sub']))  {      $connection = mysqli_connect("localhost", "root", ""); // Establishing Connection with Server    $db = mysqli_select_db($connection, "ofobms"); // Selecting Database from Server    // Check connection    if (!$connection) {        die("Connection failed: " . mysqli_connect_error());    }  $checkbox1=$_POST['techno']; //$hobb= $_POST['Hobbies']; $chk="";  foreach($checkbox1 as $chk1)     {        $chk .= $chk1.",";      }     $N = count($checkbox1);   echo("<p>You selected $N techno(s): ");   for($i=0; $i < $N; $i++)   {    $in_ch=mysqli_query($connection,"INSERT INTO order_table (item_ID)    values ('$chk')");    } if($in_ch==2)     {        echo'<script>alert("Inserted Successfully")</script>';     }  else     {        echo'<script>alert("Failed To Insert")</script>';     }  }    ?>這就是我現(xiàn)在的桌子的樣子| item_ID ||    2      |    2我希望它是這樣的,第二列保持值 3| item_ID ||    2      |    3      
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 161 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號