Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9171091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:06:57+00:00 2026-06-17T16:06:57+00:00

I’m having a problem with the checkbox in the array. I’m working on a

  • 0

I’m having a problem with the checkbox in the array. I’m working on a script that runs at soccergames (indoor) to keep track of goalscorers and other information like cards (green or red).

Here’s the code for the away team table. The problem is with the checkboxes. When unchecked they don’t send any value. I need them to send ‘0’ as value when unchecked and ’30’ when checked.

   $sql1="SELECT dbo_doelpunten.TeamRelatieNummer, dbo_doelpunten.aantaldoelpunten, dbo_doelpunten.Deelnemer, dbo_doelpunten.aantalstrafminuten, dbo_Deelnemers.Deelnemer, dbo_Deelnemers.MinutenStrafVerwerkt, dbo_Deelnemers.Doelpunten, dbo_Deelnemers.NaamCombi
    FROM dbo_doelpunten
    LEFT JOIN dbo_Deelnemers
    ON dbo_doelpunten.Deelnemer=dbo_Deelnemers.Deelnemer
    WHERE dbo_doelpunten.TeamRelatieNummer='436'
    ORDER BY dbo_doelpunten.Deelnemer
    ";
    // $sql1="SELECT * FROM dbo_doelpunten WHERE TeamRelatienummer='436'";
    $result1=mysql_query($sql1);

    // Count table rows 
    $count=mysql_num_rows($result1);
    $Deelnemer = array();
    ?>
    <td>
    <table id="table" class="table"  width="400"> 
    <thead> 
    <tr> 
        <th data-sort="int">Nr</th>
        <th data-sort="string">Naam</th>      
        <th data-sort="int">Doelpunten</th> 
        <th data-sort="int">Tijdstraf</th> 
        <th data-sort="int">Rood?</th>
    </tr> 
    </thead>
    <tbody>
    <?php
    while($rowuit=mysql_fetch_array($result1)){
    $e=$rowuit['MinutenStrafVerwerkt'];
    if ($e>='10')
      {
      echo "<tr bgcolor='red'>";
      }
    else
      {
      echo "<tr>";
      }
      ?>
    <td width="50" class="tdata"><input name="Deelnemeruit[]" type="hidden" id="Deelnemeruit" size="10" value="<? echo $rowuit['Deelnemer']; ?>" readonly><? echo $rowuit['Deelnemer']; ?></td>
    <td width="250" class="tdata"><input name="NaamCombiuit[]" type="hidden" id="NaamCombiuit" size="20" value="<? echo $rowuit['NaamCombi']; ?>" readonly><? echo $rowuit['NaamCombi']; ?></td>
    <td width="50" class="tdata"><input name="doelpuntuit[]" type="number" min="0" max="100" size="3" id="doelpuntuit" value="<? echo $rowuit['aantaldoelpunten'] ?>"></td>
    <td width="50" class="tdata"><input name="strafuit[]" type="number" min="0" max="100" size="3" id="strafuit" value="<? echo $rowuit['aantalstrafminuten'] ?>"></td>
    <td width="50" class="tdata"><input name="rooduit[]" type="checkbox" value="30" id="rooduit"></td>
    </tr>
    <?php
    }
    ?>

Creating the array works well and the table is created good. Updating the score, goalscorers and time penalty (green cards) works well except the red card which is an checkbox. Beneath the code for updating the DB

$Deelnemerthuis = $_POST['Deelnemerthuis']; 
$NaamCombithuis = $_POST['NaamCombithuis'];
$doelpuntthuis = $_POST['doelpuntthuis']; 
$strafthuis = $_POST['strafthuis']; 
$vlaggerthuis = $_POST['vlaggerthuis']; 
$teamthuis = $_POST['teamthuis']; 
$roodthuis = $_POST['roodthuis'];

$Deelnemeruit = $_POST['Deelnemeruit']; 
$NaamCombiuit = $_POST['NaamCombiuit'];
$doelpuntuit = $_POST['doelpuntuit']; 
$strafuit = $_POST['strafuit']; 
$vlaggeruit = $_POST['vlaggeruit']; 
$teamuit = $_POST['teamuit']; 
$rooduit = $_POST['roodtuit'];




// Check if button name "Submit" is active, do this 
if(isset($_POST['Submit'])){

$i=0;
while($i<$count){
$sql3= "UPDATE dbo_doelpunten SET aantaldoelpunten = '" . $doelpuntthuis[$i] . "', aantalstrafminuten = '" . $strafthuis[$i] . "' WHERE wedstrijdid='300' AND  Deelnemer = '" . $Deelnemerthuis[$i] . "'"; 
$result3=mysql_query($sql3);


$sql7= "UPDATE dbo_Deelnemers SET MinutenStrafVerwerkt = MinutenStrafVerwerkt+'" . $roodthuis[$i] . "' WHERE Deelnemer = '" . $Deelnemerthuis[$i] . "'";
$result7=mysql_query($sql7);


$sql4= "UPDATE dbo_doelpunten SET aantaldoelpunten = '" . $doelpuntuit[$i] . "', aantalstrafminuten = '" . $strafuit[$i] . "' WHERE wedstrijdid = '300' AND Deelnemer = '" . $Deelnemeruit[$i] . "' "; 
$result4=mysql_query($sql4);

$sql8= "UPDATE dbo_Deelnemers SET MinutenStrafVerwerkt = MinutenStrafVerwerkt+'" . $rooduit[$i] . "' WHERE Deelnemer = '" . $Deelnemeruit[$i] . "'"; 
$result8=mysql_query($sql8);

$i++;
} 

How can I get the checkbox have value 0 when unchecked and 30 when checked?

I posted the full code of the page here:
http://pastebin.com/u6xVMmrr

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:06:58+00:00Added an answer on June 17, 2026 at 4:06 pm

    Checkboxes don’t send unchecked data, so you have two options:

    1. Test for the existance of the checkbox field. If it isn’t present, assume a value of 0.
    2. Have a hidden form variable with an identical variable name and value of ‘0’, which will get sent on post. If the checkbox (which appears later in the form) is checked, it will overwrite the 0 value with 30.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am confused How to use looping for Json response Array in another Array.
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.