8721 sujets

Développement web côté serveur, CMS

Bonjour,
J'aimerai que l'ID de la textarea et du bouton change à chaque affichage de textarea.
Pour cela j'ai fais ce code.

<?PHP
if(isset ($_SESSION['TabInter'])){

for($ligne=0;$ligne<sizeof($_SESSION['TabInter']);$ligne++)
{
$txt_0=0;
$btn_0=0;
$js0=0;
$_SESSION['ValueInter']= $_SESSION['Start'].$_SESSION['TabInter'][$ligne].$_SESSION['Balises3'].$_SESSION['Balises4'].'['.$str.']'.$date.$version.$code;

?>
<table align="center">
    <tr align="center">
        <td>
        <form id="form-copier" >
        <!-- //champ de saisie de texte -->
        <textarea id="<?php $txt_0.$ligne; ?>" cols="80" rows="3"disabled="disabled"><?php print_r($_SESSION['ValueInter']) ?></textarea>
        <!-- //Bouton copier -->
        <input type="button" class="<?php $js0.$ligne; ?>" id="<?php $btn_0.$ligne; ?>" value="Copier la chaîne" onclick="this.disabled = 'disabled';this.type='checkbox';this.checked='checked'">
    </form>
        </td>
    </tr>
</table>
<?PHP
print_r($txt_0);
?>

Mais l'id du bouton et de la textarea reste à 0.

Merci pour votre aide.
J'ai trouvé.

if(isset ($_SESSION['TabInter'])){
	
	for($ligne=0;$ligne<sizeof($_SESSION['TabInter']);$ligne++)
	{
	$txt_0=0;
	$btn_0=0;
	$js_0=0;
		$_SESSION['ValueInter']= $_SESSION['Start'].$_SESSION['TabInter'][$ligne].$_SESSION['Balises3'].$_SESSION['Balises4'].'['.$str.']'.$date.$version.$code;
		$txt_0 = $ligne;
		$btn_0 = $ligne;
		$js_0 = $ligne;		
	?>
		<table align="center">
    <tr align="center">
        <td>
        <form id="form-copier" >
        <!-- //champ de saisie de texte -->
        <textarea id="<?php $txt_0; ?>" cols="80" rows="3"disabled="disabled"><?php print_r($_SESSION['ValueInter']) ?></textarea>
        <!-- //Bouton copier -->
        <input type="button" class="<?php $js_0; ?>" id="<?php $btn_0; ?>" value="Copier la chaîne" onclick="this.disabled = 'disabled';this.type='checkbox';this.checked='checked'">
    </form>
        </td>
    </tr>
</table>
<?PHP
		print_r($txt_0);
		print_r($btn_0);
		print_r($js_0);
?>
Meilleure solution