小弟是刚学php的,大家帮忙看看这个如何接收值。
第一个页面1.php。如何把新增的浏览value的接收到第二个页面2.php.
<script language="javascript">
var allCount=1; 
function setupload(ln,typ)
{
var p = document.getElementById("file_input"+ln);
var e = eval("form1.file_"+ln);
if(typ==1)
p.innerHTML="<input name=file_"+ln+"   type=file value='' style='width:350px' class=inputstyle>\n";
else
p.innerHTML="<input name=file_"+ln+"   type=text value='' style='width:350px' class=inputstyle>\n";
}
function addpicline()
{
  newRow=multitbl.insertRow(multitbl.rows.length);
  newRow.id="tdt";
  newRow.ln = allCount;
  c1=newRow.insertCell(0);
  c1html="图片:\n";
  c1.innerHTML=c1html;
  c1.align='right';
  c2=newRow.insertCell(1);
  c1html="<input name=file_"+allCount+" type=file value='' style='width:350px' class=inputstyle>\n";
  c2.innerHTML=c1html;
  c2.id="file_input"+ allCount;
  
  c3=newRow.insertCell(2);
  c1html="<INPUT TYPE='radio' NAME=radio_"+allCount+" value=1 checked onclick='setupload("+allCount+",1)'> 本地上传<INPUT TYPE='radio' NAME=radio_"+allCount+" value=2  onclick='setupload("+allCount+",2)'> 远程调用\n";
  c3.innerHTML=c1html;
  c4=newRow.insertCell(3);
  c1html="&nbsp;";
  c4.innerHTML=c1html;
  c5=newRow.insertCell(4);
  c1html="<input type='button' name='btn' value='删除' onclick='delpicline("+allCount+")' class=inputstyle>\n";
  c5.innerHTML=c1html;
  c5.align='left';
  allCount++;
}
function delpicline(count)
{
  for (i=1;i<multitbl.rows.length;i++){
if (tdt[i].ln==count)
multitbl.deleteRow(i);
  }
    }
</script>
<form name="form1" method="post" action="6.php">
<table width="100%" border="1" cellspacing="0" cellpadding="2" class="allborder" bgcolor="#F7F7F7" id="tab_1">
<tr>
            <td width="12%" align="right" valign=top nowrap>商品更多图片上传</td>
            <td colspan="3"></td>
          </tr>
          <tr>
            <td width="12%" align="right" nowrap>&nbsp;</td>
            <td colspan="3">&nbsp;
              <INPUT TYPE="button" onClick="addpicline()" value="新增" class=inputstyle>
              <INPUT TYPE='checkbox' NAME='multi_wm' value=1  disabled>开启水印(仅作用于本地上传的图片)</td>
          </tr>
          <tr>
            <td colspan="4">
<table width=100% class=p9black id=multitbl>
                <tr id=tdt>
                  <td width=12%></td>
                  <td width=35%></td>
                  <td width=15%></td>
                  <td width=5%></td>
                  <td width=33%></td>
                </tr>
            </table>
</td>
<tr>
            <td colspan="4"><input type="submit" value="提交" name="submit" onclick="return test();"></td>
          </tr>
        </table>
</form>

解决方案 »

  1.   

    在6.php中执行 print_r($_POST);
    就知道了
      

  2.   

    这个是打印出来的结果,好像不是我所要的呀
    Array ( [file_1] => C:\\Documents and Settings\\Administrator\\桌面\\az-add-to-favorites-sm-pri.gif [radio_1] => 1 [submit] => 提交 ) 
      

  3.   

    上传文件要有enctype="multipart/form-data"用$_FILES取得
      

  4.   

    写了一个,具体你自己要看清楚1.php中的html和javascript代码给出2.php(你给的代码中是post到6.php中)参考代码,自己调试成功:
    <?php
    $i = 1;do {
    $temp = "file_$i";
    $i++;
    echo $_REQUEST["$temp"].'<br />';
    }
    while (isset($_REQUEST["$temp"]));
    ?>
    例子中没有更多的判断,根据实际需要增加你要的代码。