Answer the question
In order to leave comments, you need to log in
Where is the php foreach error?
<?if (count($arResult["ERRORS"]) > 0)
foreach ($arResult["ERRORS"] as $key => $error)
if (intval($key) == 0 && $key !== 0):?>
<div class="alert alert-danger" role="alert">
<?$arResult["ERRORS"][$key] = str_replace("#FIELD_NAME#", """.GetMessage("REGISTER_FIELD_".$key).""", $error);
ShowError(implode("<br />", $arResult["ERRORS"]));
?>
</div>
<?elseif($arResult["USE_EMAIL_CONFIRMATION"] === "Y"):?>
<p><?echo GetMessage("REGISTER_EMAIL_WILL_BE_SENT")?></p>
<?endif?>
Answer the question
In order to leave comments, you need to log in
It is necessary that each error be in a separate alert block
<div class="alert alert-danger" role="alert">
<?echo str_replace("#FIELD_NAME#", """.GetMessage("REGISTER_FIELD_".$key).""", $error);?>
</div>
You have non-closed constructions if
and foreach
.
<?php if (count($arResult["ERRORS"]) > 0) : ?>
<?php foreach ($arResult["ERRORS"] as $key => $error) : ?>
<?php if (intval($key) == 0 && $key !== 0) : ?>
<div class="alert alert-danger" role="alert">
<?php
$arResult["ERRORS"][$key] = str_replace("#FIELD_NAME#", """.GetMessage("REGISTER_FIELD_".$key).""", $error);
ShowError(implode("<br />", $arResult["ERRORS"]));
?>
</div>
<?php elseif ($arResult["USE_EMAIL_CONFIRMATION"] === "Y") : ?>
<p><?php echo GetMessage("REGISTER_EMAIL_WILL_BE_SENT") ?></p>
<?php endif; ?>
<?php endforeach; ?>
<?php endif ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question