Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript Tableau sur Input - EN: Array on Input

scombre

New Coder
Bonjour,
Débutant en JavaScript. J'aurais voulu savoir où se trouve le souci du code ci-dessous. C'est le nombre d'articles est supérieur à 1 la valeur envoyé est correct.
Si l'article est égal à un il y a une erreur car la valeur se trouve dans Inpt3.value (l'index n'est pas pris en consideration!
Merci d'avance de votre aide
Stéphane



English translation:
Hello,
Beginner in JavaScript. I would have liked to know where is the concern of the code below. It is the number of items is greater than 1 the value sent is correct.
If the article is equal to one there is an error because the value is in Inpt3.value (the index is not taken into consideration!
Thank you in advance for your assistance
Stephane

Translated with Google Translate. Translation may not be accurate.


PHP:
<?
$nbArticles=1;
          for ($i=0 ;$i < $nbArticles ; $i++)
          { ?>
            <div class="media-body">
                                <input id="lInpt3" name="lInpt3[<?php echo $i ?>]" value="<? echo "valeur ".$i?>"><BR><br>
                            <input onchange=CartUpdate(<? echo $i ?>) align="right" class="form-control" type="number" id="qI" name="qI[<? echo $i ?>]" value="<? echo htmlspecialchars($_SESSION['panier']['qteProduit'][$i]) ?>"><? echo $i ?></span>
                        </div>
            <?  }?>

<script>
function CartUpdate(index){
    alert(lInpt3[index].value);
  };
</script>
 
Last edited by a moderator:
Back
Top Bottom