You should consider using forms and arrays.
An example from a multiple-tutorials submit form I made last week:
Make a common field named 'count[]'
<input type="hidden" name="count[]" value="" />
Each time you put that field, we add one to our count. Put this in all of the submit forms.
This way we can count how many thigns were submitted by doing:
$count = count( $_POST['count'] );
$_POST['count'] holds an array of data for each time the form field count[] appears.
Now this is what your form should look like:
Tutorial #1:<br />
<input type="text" name="title[]" /><br />
<input type="test" name="author[]" /><br />
<input type="hidden" name="count[]" value="" />
<br />
Tutorial #2:<br />
<input type="text" name="title[]" /><br />
<input type="test" name="author[]" /><br />
<input type="hidden" name="count[]" value="" />
<br />
Now to get all form data, we loop through our array:
$count = count( $_POST['count'] );
for( $i=0; $i < $count; $i++ )
{
// get data for tutorial $i + 1
$current_tutorial = $i + 1;
$current_title = $_POST['title'][ $i ];
$current_author = $_POST['author'][ $i ];
}
This is essentially what it should look like.
Edited by Ruben K, 31 August 2006 - 06:52 AM.