[FX.php List] Submitting multiple values as hidden

Steve Bennett steve at bentechaps.com
Sun Apr 29 14:21:32 MDT 2007


I am working on an online time sheet, using FX, where the employee  
may have been assigned to different departments and needs to submit  
separate time sheets for each department.

I have the employee login with a username/password and a search finds  
all of the departments that they have been assigned to so that they  
can create a time sheet for each. The search returns the found  
records and wraps each one in a form so that they can input the week  
number and click a button to create a time sheet record for that  
assignment.

The form submit process is supposed to post some of the found  
information as hidden data but it is not posting all of the required  
fields even though they contain data in the form.

Here is the code that generates the list of forms for the found set:


   <?php foreach($search_results_result['data'] as  
$search_results_row_key=>$search_results_row){ ?>
   <form action="../timesheets/ts_add.php" method="post"  
name="new_timesheet" id="new_timesheet">
   <tr>
     <td><a href="placement_details.php?id=<?php echo array_shift 
(explode('.',$search_results_row_key)); ?>"><?php echo  
$search_results_row['zzKP_OrderPlacementID_ta'][0]; ?></a></td>

     <td><?php echo $search_results_row['Candidate_Name_al'][0]; ?></td>
     <td><?php echo $search_results_row['zzKF_CandidateID_t'][0]; ?></ 
td>
     <td><?php echo $search_results_row['zzKP_OrderPlacementID_ta'] 
[0]; ?></td>

<td>
         <input type="text" name="week_ending_date"  
id="week_ending_date">
       </td>

       <input name="Candidate_Name_al" type="hidden" value="<?php  
echo $search_results_row['Candidate_Name_al'][0]; ?>"  
id="Candidate_Name_al" />
       <input name="zzKF_CandidateID_t" type="hidden" value="<?php  
echo $search_results_row['zzKF_CandidateID_t'][0]; ?>"  
id="zzKF_CandidateID_t" />
       <input name="zzKP_OrderPlacementID_ta" type="hidden" value="<? 
php echo $search_results_row['zzKP_OrderPlacementID_ta'][0]; ?>"  
id="zzKP_OrderPlacementID_ta" />

       <td><input type="submit" name="new_timesheet" value="New  
Timesheet" />      </td>
     </tr>
   </form>


On the form processing page I am storing the data in a session but I  
am only getting data posted for the: "zzKF_CandidateID_t" and  
"week_ending_date" but nothing gets posted for the:  
"Candidate_Name_al" and "zzKP_OrderPlacementID_ta" it just gives an  
"Undefined index" error. What is really frustrating as that there is  
data being displayed in the found set for these two fields along with  
the "zzKF_CandidateID_t" which does post correctly using the hidden  
input type.

Here is the code for the form processing to capture the posted data  
into a session and I echo the session information to try and see what  
is going on:


session_start();
$_SESSION['zzKF_CandidateID_t']=$_POST['zzKF_CandidateID_t'];
$_SESSION['zzKP_OrderPlacementID_ta']=$_POST 
['zzKP_OrderPlacementID_ta'];
$_SESSION['Candidate_Name_al']=$_POST['Candidate_Name_al'];
$_SESSION['week_ending_date']=$_POST['week_ending_date'];
?>

<?php /*?>remove session echo after testing is done<?php */?>
<?PHP echo $_SESSION['zzKF_CandidateID_t'] ?> <BR />
<?PHP echo $_SESSION['zzKP_OrderPlacementID_ta'] ?><BR />
<?PHP echo $_SESSION['Candidate_Name_al'] ?><BR />
<?PHP echo $_SESSION['week_ending_date'] ?><BR />


Any ideas or examples would be greatly appreciated,

Steve






More information about the FX.php_List mailing list