[FX.php List] Accepting user input on multiple records simultaneously

Steve Bennett steve at bentechaps.com
Tue Apr 24 09:55:11 MDT 2007


I have been using a process to select multiple courses and return  
their Course ID using a form and session. I only recall seeing the  
Course ID in the session and not the input button text.

On the Form page I show the Course ID and a checkbox that they can  
select to include the course in their application.

<td><?php echo $search_results_row['zzKP_CourseID_ta'][0]; ?></td>
<td><input type="checkbox" name="selectedCourses[]" value="<?php echo  
$search_results_row['zzKP_CourseID_ta'][0]; ?>">Include</td>


On the receiving page I create a session and implode the posted  
Course ID. The session is then used to flag include course interests  
when they submit their application.

<?php require_once('../Connections/online_courses.php');
session_start();
$_SESSION['SelectedCourses']=@implode ("\r\n",$_POST 
['selectedCourses']);
?>

On Apr 24, 2007, at 9:02 AM, Andrew Denman wrote:

> You can do an unset($_POST[‘click’]); before running the foreach.
>
>
>
> Andrew Denman
>
>
> From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list- 
> bounces at mail.iviking.org] On Behalf Of Jonathan Schwartz
> Sent: Monday, April 23, 2007 8:35 PM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] Accepting user input on multiple records  
> simultaneously
>
>
>
> Almost there with the brute force solution....
>
>
>
> So far, I have:
>
>         1) Added a check box to every line item in the line listing  
> of found records.
>
>         2) Added a form around the entire listing, with submit button.
>
>         3) Pointed the submit button to a new file that processes  
> the $_POST array (this is the root of the question)
>
>         4) perform a foreach to update each record with the -recid  
> sent over from the check box on the original page.
>
>
>
> Everything works in spite of my fumbling.  The only problem is that  
> I am using $_POST which returns exactly 1 line more than the actual  
> number of boxes checked (the input buttton name is included):
>
>
>
> [1] => 1
>
>     [2] => 2
>     [3] => 3
>     [32] => 32
>     [34] => 34
>     [37] => 37
>     [41] => 41
>     [44] => 44
>     [48] => 48
>     [52] => 52
>     [click] => Submit Selections
>
>
>
> So, the final loop of the foreach produces an error.
>
>
>
> Is there a better way to handle the array from the $_POST?
>
>
>
> J
>
> --
> Jonathan Schwartz
>
> Exit 445 Group
>
> jonathan at exit445.com
>
> http://www.exit445.com
>
> 415-381-1852
>
> FileMaker 8 Certified Developer
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list