Forms with a variable number of fields

后端 未结 3 986
情书的邮戳
情书的邮戳 2020-12-18 08:34

I\'m attempting to create a sort of marketplace. Each item on the market has a type (i.e. the item being sold), a value, a quantity, a seller name, and an id, and all of thi

3条回答
  •  半阙折子戏
    2020-12-18 09:24

    For the first problem, simple. Do:

    for ($i = 0; $i < sizeOf($returnedSQLarray); $i++) {
    //your display code
    ....
    
    ....
    echo("");
    }
    

    although I still am having trouble imagining why you can't use the product's ID in the quantity's name attribute somehow. for() loops are great for this kind of looping, though, so if this really is the way you need to handle it you're covered.

    The hidden input is fine. Pretty standard, even. Anyone who wants to can send your webserver whatever data they want, so you should only really care about serverside security anyway.

提交回复
热议问题