日期:2014-05-17  浏览次数:20446 次

求助怎样用for循环使变量名称递增?急!急!急!
我的SQL语句是:$insertSQL="INSERT INTO yx_tab2_m (id,qj_date,Customer_num,Customer_name,kanyang,print,xiupian,tiaose,tx_tiaose,design,check_m,other) VALUES('$table_id','$_POST[qj_date1]','$_POST[Customer_num1]','$_POST[Customer_name1]','$_POST[kanyang1]','$_POST[print1]','$_POST[xiupian1]','$_POST[tiaose1]','$_POST[tx_tiaose1]','$_POST[design1]','$_POST[check1]','$_POST[other1]')";
其中$_POST[qj_date1],$_POST[Customer_num1],$_POST[Customer_name1]…………这些是通过表单获取到的值,但是提交表单有很多表格,而且都是有规律的,我想用for循环把$_POST[qj_date1],$_POST[Customer_num1],$_POST[Customer_name1]…………变成$_POST[qj_date2],$_POST[Customer_num2],$_POST[Customer_name2]…………就相当于是把来自于表单的这些变量名称的表单元素的名称递增1,我怎么弄SQL语句都是错误的,请高手帮忙,如果您看不懂,请联系QQ:1677546723,帮帮我,这个问题困扰我好几天了……

------解决方案--------------------
for($i=0;$i<100;$i++){
echo $_POST['qj_date'.$i];
}