dongmu5815 2013-04-04 12:34
浏览 44

php中的javascript将值传递给javascript值

I have use code as shown below:

  <?  
$sql = mysql_query("select * from tbl_item where item_category = '$item_cat'");
$i=1;
  while($crows = mysql_fetch_array($sql))
  {
    ;
  ?>    

  <tr>
    <td width="57" align="center" ><? echo $i;?></td>
    <td width="540" align="center" onClick=><div align="center"><? echo $crows["item_name"];?> </div></td>
    <td width="385" align="center">
      1<input name="<? echo $crows["item_name"];?>" type="radio" id="radioqty<? echo $i;?>" value="1" checked="checked"  />

      2<input type="radio" name="<? echo $crows["item_name"];?>" id="radioqty<? echo $i;?>" value="2" />

      3<input type="radio" name="<? echo $crows["item_name"];?>" id="radioqty<? echo $i;?>" value="3" />

      4<input type="radio" name="<? echo $crows["item_name"];?>" id="radioqty<? echo $i;?>" value="4" />
    </td>
    <td width="249" align="center" >
      Full<input name="radioplate<? echo $i?>" type="radio" id="radioplate<? echo $i?>" value="full" checked="checked" /> 
      Half<input type="radio" name="radioplate<? echo $i?>" id="radioplate<? echo $i?>" value="half" /></td>

    <td width="281" align="center">
      <input name="serve" type="button" value="Serve" onclick="get_code('a','get_item_save.php?item_id='+<? echo $crows["item_id"];?>+'&cat_id='+document.exB.item_category.value+'&plate_type='+document.exB.radioplate<? echo $i?>.value+'&qty='+exB.radioqty<? echo $i;?>.value+'&bill_no='+document.exB.bill_summary_bill_no.value+'&bill_date='+document.exB.bill_summary_date.value),get_code('b','get_item_sale_list.php?bill_no='+document.exB.bill_summary_bill_no.value)"/>      </td>
  </tr>
  <? $i++; }?>

Here I'm doing something wrong when I call get_code function and I'm unable to figure out were I'm wrong. Could someone figure out what I'm doing wrong on this line of code:

<td width="281" align="center">
    <input name="serve" type="button" value="Serve" onclick="get_code('a','get_item_save.php?item_id='+<? echo $crows["item_id"];?>+'&cat_id='+document.exB.item_category.value+'&plate_type='+document.exB.radioplate<? echo $i?>.value+'&qty='+exB.radioqty<? echo $i;?>.value+'&bill_no='+document.exB.bill_summary_bill_no.value+'&bill_date='+document.exB.bill_summary_date.value),get_code('b','get_item_sale_list.php?bill_no='+document.exB.bill_summary_bill_no.value)"/>      </td>

I get an error at: document.exB.radioplate<? echo $i?>.value show undefined.

  • 写回答

1条回答 默认 最新

  • duanmei1850 2013-04-04 12:38
    关注

    Maybe with mysql_fetch_array($sql, MYSQL_ASSOC) in the while statement.

    With the MYSQL_ASSOC you can retrieve the fields by its name, like crows['item_name'].

    评论

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用