Note that there are some explanatory texts on larger screens.

plurals
  1. POHandling several different form input fields php
    primarykey
    data
    text
    <p>My site contains several forms for users to fill. One of those forms could result in a lot of work. That´s why I´m reaching out for consent. You see, in this form, there will be 40 games. And every game gives the users 2 fields to enter a number (depending on how they think the game will end). So with 40-50 games it means that I have 80-90 fields to keep track of. The two fields will be paired with the right game in the database, and the users answer will be remembered at all time. This is a snap of my code:</p> <pre><code>&lt;div class="form-left"&gt;England- Italy&lt;/div&gt; &lt;div class="form-right"&gt;&lt;input type="result" id="g1r1" name="g1r1" class="form-input" /&gt;&lt;/div&gt; &lt;div class="form-dash"&gt;-&lt;/div&gt; &lt;div class="form-right"&gt;&lt;input type="result" id="g1r2" name="g1r2" class="form-input" /&gt;&lt;/div&gt; &lt;div class="form-error"&gt;&lt;/div&gt; &lt;div class="form-left"&gt;Spain- Mexico&lt;/div&gt; &lt;div class="form-right"&gt;&lt;input type="result" id="g2r1" name="g2r1" class="form-input" /&gt;&lt;/div&gt; &lt;div class="form-dash"&gt;-&lt;/div&gt; &lt;div class="form-right"&gt;&lt;input type="result" id="g2r2" name="g2r2" class="form-input" /&gt;&lt;/div&gt; &lt;div class="form-error"&gt;&lt;/div&gt; </code></pre> <p>My thought is, naming the games game1row1 and game1row2. To be able to match them to the correct game in the database. Problem is that an insertion to a table with 90 fields seems hugh. So my question would be: <em>How can this be done in a better way? With less lines of code on the insert-database side..</em></p> <pre><code> insert into tablename ( g1r1, g1r2 values 1, 0 where MATCH_ID = MATCHID) </code></pre> <p><strong>EDIT</strong></p> <p>To clarify, My table contains ID, user_id, match_id(g), homeScore(r1), awayScore(r2). My idea of g1r1 and g1r2 is to save r1 and r2 at right g(game).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload