Home >Backend Development >PHP Tutorial >name是变量,怎么把VALUE写入数据库

name是变量,怎么把VALUE写入数据库

WBOY
WBOYOriginal
2016-06-13 12:01:191084browse

name是变量,如何把VALUE写入数据库


while (!!$_rows = _fetch_array_list($_result2)){<br />?><br /><tr><td><?php echo $_rows['bh'];?><br /><input name="bh[]" type="hidden" value="<?php echo $_rows['bh'];?>"/><br /></td><?php $_values=$_rows['bh'];?><br /><td><?php echo $_rows['xm']?><br /><input name="xm[]" type="hidden" value="<?php echo $_rows['xm'];?>"/><br /></td><br /><td><?php echo $_rows['fangfa']?><br /><input name="fangfa[]" type="hidden" value="<?php echo $_rows['fangfa'];?>"/><br /></td><br /><td><?php echo $_rows['biaozhun']?><br /><input name="biaozhun[]" type="hidden" value="<?php echo $_rows['biaozhun'];?>"/><br /></td><br /><td><input type="radio" name="<?php echo $_values?>" value="正常"   style="max-width:90%" />正常<br /><input type="radio" name="<?php echo $_values?>" value="不正常"/>不正常</td><br /></tr>



这句
<td><input type="radio" name="<?php echo $_values?>" value="正常" style="zoom:150%;" />正常<br /><input type="radio" name="<?php echo $_values?>" value="不正常"/>不正常</td>

不知道怎么弄,name是变量,怎么传到数据库里?



下面是处理的语句

<?php <br />$hh=$_POST['hao1'];<br />$aa=$_POST['bh'];<br />$bb=$_POST['xm'];<br />$cc=$_POST['fangfa'];<br />$dd=$_POST['biaozhun'];<br />$_gh=$_COOKIE["name"]; <br />$_time=$_POST['time'];<br />$zt=$_POST[''];<br /><br /><br />$name=implode(_fetch_array_list(mysql_query("SELECT name FROM jsy WHERE gonghao = $_gh")));<br />if (is_array($aa)){<br />foreach ($aa as $i=>$v){<br /> mysql_query("INSERT INTO djjl (hao,bh,xm,fangfa,biaozhun,gonghao,name,time,zt) VALUES (<br />'$hh',<br /> '$v',<br />'{$bb[$i]}',<br />'{$cc[$i]}',<br />'{$dd[$i]}',<br />'$_gh',<br />'$name',<br />'$_time',<br />'{$zt[$i]}'<br />)" )or die('SQL执行失败!'.mysql_error());}}<br />mysql_close();<br />_alert_location('添加成功!','ksdj.php');<br />?>




------解决方案--------------------
这样命名试下:
$i=0;
while (!!$_rows = _fetch_array_list($_result2)){
............

]" value="正常" style="zoom:150%;" />正常
]" value="不正常"/>不正常

$i++;
}

然后提交后:
$zt=$_POST['zt'];  可以参与遍历。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn