传递表单后只获得一半数组

时间:2016-09-05 03:57:33

标签: php html sql forms

我有两种形式。提交第一个表单后,它将转到第二个表单,我需要从第一个表单中获取值。这是表格的第一部分:

<?php $result2 = getProcessID();?>
<form class="formcss" method="post" action="create2.php" >
<div class="row">
<div class="small-8 large-8 columns">
    <label>Process: <small style="color:red;">*</small>             
        <div class="multiselect">               
            <div class="selectBox">                 
                <select onclick="showCheckboxes()"  class="input input1 name">
                    <option>-- Select a process -- Add number of people reqired --</option>
                </select>

                <label class="tool tool1" for="name" style="top:-15px; margin-left:-14px;  left:-207px; ">Choose process and number <br> of people required</label>
                <div class="overSelect"></div>
            </div>
            <div class="scrollable" id="checkboxes">
            <?php 
                while ($row = mysql_fetch_array($result2))
                {
                    $row[0] = cleanOutputData($row[0]); 
            ?>      
            <div class="row">
                <div class="small-6 large-6 columns">
                    <label style="height: 38px;">
                    <input type='checkbox' style="width:20%;" name='process[]' id=<?php echo $row[0] ?>  value=<?php echo $row[0] ?>/><?php echo $row[0] ?>
                    </label>    
                </div>

                <div class="small-6 large-6 columns">
                    <label><input type='text'style="margin-left:50%; width:20%;" name='number[]'/>
                    </label>
                </div>
            </div>
            <?php
                }
                mysql_free_result($result2);
            ?>
            </div>
        </div>
    </label>
</div>
</div>
</form>

除了两个问题外,显示第二种形式的值似乎很好: 1)只显示一半的过程 2)我只能为前3个进程编号,但对于其他进程,它仍然是空字段。 这是我的第二种形式:

$_SESSION['process'] = $_POST['process'];
$_SESSION['number'] = $_POST['number'];

$proc=$_SESSION['process'];
$len = count($proc); // getting length of an array 

$num=$_SESSION['number'];

<form class="formcss" method="post" action="create.php#err" id="reportform" enctype="multipart/form-data">
<div id="project" class="small-9 large-9 columns">
<label style="font-size: 40px; margin-left:10%;">Project <?php echo $_SESSION["title"]; ?></label>
    <label><?php for($y=0;$y<$len;$y++)
              {
                echo "Process:   "."$proc[$y]"."<br />";
                echo "People required:   "."$num[$y]"."<br />";         
            ?>
            <ol>
            <li class="placeholder" <?php if (isset($leader)) echo 'value="'.$leader.'"' ?>>Add people here</li>
            </ol>
            <?php                       
                }
             ?>
</label>

<br><br><br>
<div class="row">
    <input type = "submit" style="margin-left:300px; width:150px;"  name ="submit" class="button" value = "Create Project" onclick="userSubmitted = true;"/>    
</div>
</div>  
</form>

正如我所说,只显示了一半的过程,例如,我有一个ANM KEY&#39;过程,当我传递该值并将其显示在另一个表单上时,它仅显示“ANM”。此外,我想显示每个进程所需的人数,但它仅适用于前三行。那么我如何获得流程的全名,并显示所需的人数。谢谢!

0 个答案:

没有答案