Помогите PHP + JS + FPDF

Проблема в том что мне нужно передать постом имена которые заключены в массив и в fpdf проиндексировать их. Есть несколько массивов, имя автора и имя организации и вот я не знаю как сделать так что б скрипт понимал что первые 3(их может быть от 1 до n) организации относятся к первому автору. Я пробовал с помощью JS создавать новые поля и таким образом создавать многомерный массив для каждой организации. Но проблема в том что на выходе все равно не понятно что к какой организации относится. Выводит вот так

["organization"]=>
  array(6) {
    [0]=>
    array(1) {
      [0]=>
      string(0) ""
    }
    [1]=>
    array(1) {
      [0]=>
      string(0) ""
    }
    [2]=>
    array(1) {
      [0]=>
      string(10) "орг 1.1"
    }
    [3]=
    array(1) {
      [0]=>
      string(10) "орг 1.2"
    }
    [4]=>
    array(1) {
      [0]=>
      string(10) "орг 2.1"
    }
    [5]=>
    array(1) {
      [0]=>
      string(10) "орг 2.2"
    }
  }

А нужно что б было вот так:

["organization"]=>
  array(2) {
    [0]=>
    array(2) {
      [0]=>
      string(10) "орг 1.1"
      [1]=>
      string(10) "орг 1.2"
    }
    [1]=>
     array(2) {
      [0]=>
      string(10) "орг 2.1"
      [1]=>
      string(10) "орг 2.2"
    }
  }

Подскажите может что не правильно делаю либо иду не в том направлении. Необходимый код могу прикрепить.

$(document)
	.ready(function () {
		var links = $('.control-org')
			.clone(true);
		$('#os')
			.click(function () {

				$(links)
					.clone(true)
					.appendTo('#org')
					.fadeIn('slow')
					.find("input[name*=organization_ru]")
					.focus();
				if($('.control-org').length == 5) $(this).hide();
			});
	});
$i = 1;
$(document)
$("#os1").hide()

	.ready(function () {
		var variant = $('.control-group')
			.clone(true);

		$('#ss')
			.click(function () {
				$("#os1").show()
				$(variant)
					.clone(true)
					.appendTo('#variants')
					.fadeIn('slow')
					.find("input[name*=f_name_a_ru]")
					.find("input[name*=l_name_a_ru]")
					.find("input[name*=m_name_a_ru]")
					.find("input[name*=email_a_ru]")
					.find("input[name*=organization_ru]")


					.focus();


				if($('.control-group').length == 5) $(this).hide();
				$i++;
			});

	});

$(document)
	.ready(function () {
		var links = $('.control-org')
			.clone(true);
		$('#os1')
			.click(function () {

				$(links)
					.clone(true)
					.appendTo('#variants')
					.fadeIn('slow')
					.find("input[name*=organization_ru]")
					.focus();
				if($('.control-org').length == 5) $(this).hide();
			});
	});

$(document)
	.ready(function () {
		var links = $('.control-groups')
			.clone(true);
		$('#ls')
			.click(function () {

				$(links)
					.clone(true)
					.appendTo('#links')
					.fadeIn('slow')
					.find("input[name*=links_ru]")
					.focus();
				if($('.control-groups').length == 5) $(this).hide();
			});
	});
<script>
	function redirectOutput(form) {
		var w = window.open('about:blank','Popup_Window','width=700,height=700,menubar=yes,toolbar=no,location=no,status=no');
		form.target = 'Popup_Window';
		return true;
	}

</script>


	<div>
		<!--	                        rus-->

			<form class="form-horizontal" role="form" action='article.php?article=<?=$_SESSION['login']?>' onSubmit="redirectOutput(this)" method='POST'>
				<div class="row">
					<div class="col">
						<div class="form-group">
							<label for="selectForm"><?=LANG_FORM?></label>
						<select class="custom-select" name="stend">
							<option name="stend" selected><?=LANG_STAND1?></option>
							<option name="stend"><?=LANG_STAND2?></option>
							<option name="stend"><?=LANG_STAND3?></option>
<!--							<option value="3">Заочно</option>-->
						</select>
						</div>
					<div class="form-group">
						<label for="exampleInputArticle1"><?=LANG_DOCLAD?></label>
						<input class="form-control" id = "exampleInputArticle1" type="text" placeholder="<?=LANG_DOCLAD?>" value="<?=$article_ru?>" name='article_ru'>
					</div>
					<div class="bord-form">
<!--						<div id="variants">-->
							<div class="form-group control-group">
								<label for="InputFirstName[]"><?=LANG_FNAME?> <?=LANG_AUTHOR?></label>
								<input class="form-control" id="InputFirstName[]" type="text" placeholder="<?=LANG_FNAME?> <?=LANG_AUTHOR?>" value="<?=$f_name_a_ru?>" name='f_name_a_ru[]'>
								<!--<a class="del_variant">X</a>-->
							</div>
							<div class="form-group control-group">
								<label for="InputLastName1"><?=LANG_LNAME?> <?=LANG_AUTHOR?></label>
								<input class="form-control" id="InputLastName1" type="text" placeholder="<?=LANG_LNAME?> <?=LANG_AUTHOR?>" value="<?=$l_name_a_ru?>" name='l_name_a_ru[]'>
							</div>
							<div class="form-group control-group">
								<label for="exampleInputName1"><?=LANG_MNAME?> <?=LANG_AUTHOR?></label>
								<input class="form-control" id="exampleInputName1" type="text" placeholder="<?=LANG_MNAME?> <?=LANG_AUTHOR?>" value="<?=$m_name_a_ru?>" name='m_name_a_ru[]'>
							</div>
<!--						</div>-->
						<div class="form-group control-group">
							<label for="exampleInputPhone1">Email <?=LANG_AUTHOR?></label>
							<input type="email" class="form-control" id="exampleInputEmail11" value="<?=$email_a_ru?>" name='email_a_ru[]'>
						</div>

						<input type="hidden" name="bar0[]">
						<div class="form-group control-org control-group">
							<label for="exampleInputEmail1"><?=LANG_ORGAN?> <?=LANG_AUTHOR?></label>

							<input type="text" class="form-control" id="exampleInputOrganization12" aria-describedby="organizationHelp" value="<?=$organization_ru?>" name='organization_ru[][]'>

						</div>
						<div id="org"  ></div>
						<span id="os">+ <?=LANG_NEWORG?></span>
					</div>
						<div id="variants" class="info">
						
						</div>
						<span id="os1">+ <?=LANG_NEWORG?></span><br>


						<span id="ss" >+ <?=LANG_NEWUTHOR?></span>


						<div class="form-group">
							<label for="exampleInputAbstracts1"><?=LANG_ABSTRACTS?></label>
							<textarea class="form-control" name="abstract_ru" id="exampleInputAbstracts1" cols="30" rows="10"></textarea>

						</div>
						<div id="links">
							<div class="form-group control-groups">
								<label for="InputLinks[]"><?=LANG_LINKS?></label>
								<input type="text" class="form-control" id="InputLinks[]" value="<?=$links_ru?>" name='links_ru[]'>
							</div><!--<a class="del_variant">X</a>-->

						</div>
						<span id="ls">+ <?=LANG_NEWLINKS?></span><br>

						<button type="submit" class="btn btn-primary" target="_blank">Предварительный просмотр</button>

				</div>

				</div>
			</form>

</div>
Нужно в этот кусок кода проставить:

foreach ($f_name_a_ru as $k => $v) {

                //
                $this->Cell($w,5, preg_replace('~^(\S++)\s++(\S)\S++\s++(\S)\S++$~u', '$1 $2.$3.', $v. ' '. $l_name_a_ru[$k]. ' '.$m_name_a_ru[$k]) . ', ',0,1,'L');
            }

$v. ' '. $l_name_a_ru[$k]. ' '.$m_name_a_ru[$k] - Тут фамилия имя отчество. Нужно чтоб после каждого имени стояла цифра относящая к той или иной организации что-то типа Пупкин И.О 1,2.


Ответы (0 шт):