du512053619 2015-10-04 06:44
浏览 12

如果使用php分配,我如何获得select标签的名称? 我想将它存储在数据库中

here is the code. I m using multiple select in the code having same values. Please help me ..have to add different items in database so I am having multiple select tag at the same time different items can be added using different select options.

 <?php

$db_host='localhost';
$db_user='root';
$db_pass='';
$db_database='foodwrap1';
$con=mysqli_connect("$db_host", "$db_user", "$db_pass")or die("cannot connect"); 
mysqli_select_db($con,$db_database)or die("cannot select DB");
$id=$_SESSION['restid']; 
$sql="Select cat_name from category where rest_id=$id";
$result=mysqli_query($con,$sql) or die(mysql_error()."no data");

                 ?>
                      <td width="7" height="39"></td>
                      <td >Select Category</td> 
                      <?php $scat=implode("cat",$k);?>
                       <td colspan="3"><select name="<?php echo $cat?>">//name assigned to select 
                        <?php
             while($row=mysqli_fetch_row($result))
             {


                $ca = $row[0];
            ?>
                          <option value="<?php echo $ca; ?>"><?php echo $ca;}?></option>
                        </select>




if(isset($_POST['additems']))
{
    for($i=1;$i<=10;$i++)
    {
    $icat=$_POST['']; // what to write here?how will i get the name.
    echo $icat;
    }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 个人网站被恶意大量访问,怎么办
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)