html - How to add multiple score results PHP MYSQL -
i want add multiple scores. if way second fill in form isn't working. first fill in form working good. know not nice code how can 1 code type?
hope can help
this code:
<form action="e2admin.php" method="post"> <div class="input-group"> <input style="width:410px;" type="text" class="form-control" name="date" placeholder="datum" /><br> <select name="thuisteam1"> <option value=""></option> <?php mysql_data_seek($result, 0); if(mysql_num_rows($result) > 0){ while($row = mysql_fetch_array($result)) { echo '<option value="' . $row['team'] . '">' . $row['team'] . '</option>'; } } ?> </select> <input style="width:20px; text-align:center;" type="text" class="form-control" name="scorethuis1" placeholder="0" /> - <input style="width:20px; text-align:center;" type="text" class="form-control" name="scoreuit1" placeholder="0" /> <select name="uitteam1"> <option value=""></option> <?php mysql_data_seek($result, 0); if(mysql_num_rows($result) > 0){ while($row = mysql_fetch_array($result)) { echo '<option value="' . $row['team'] . '">' . $row['team'] . '</option>'; } } ?> </select><br> <select name="thuisteam2"> <option value=""></option> <?php mysql_data_seek($result, 0); if(mysql_num_rows($result) > 0){ while($row = mysql_fetch_array($result)) { echo '<option value="' . $row['team'] . '">' . $row['team'] . '</option>'; } } ?> </select> <input style="width:20px; text-align:center;" type="text" class="form-control" name="scorethuis2" placeholder="0" /> - <input style="width:20px; text-align:center;" type="text" class="form-control" name="scorethuis2" placeholder="0" /> <select name="uitteam2"> <option value=""></option> <?php mysql_data_seek($result, 0); if(mysql_num_rows($result) > 0){ while($row = mysql_fetch_array($result)) { echo '<option value="' . $row['team'] . '">' . $row['team'] . '</option>'; } } ?> </select><br> <input style="margin-left:330px;" type="submit" class="form-control" value="toevoegen" /> </div> </form> <?php if( $_post['scorethuis1'] > $_post['scoreuit1']) { //echo $_post["thuisteam1"]; mysql_query("update e2teams set punten = punten+3 team ='".$_post['thuisteam1']."'"); } else if( $_post['scorethuis1'] > $_post['scoreuit1']) { //echo $_post["thuisteam1"]; mysql_query("update e2teams set punten = punten+3 team ='".$_post['uitteam1']."'"); } else if( $_post['scorethuis1'] == $_post['scoreuit1']) { //echo $_post["thuisteam1"]; mysql_query("update e2teams set punten = punten+1 team in ('".$_post['thuisteam1']."', '".$_post['uitteam1']."') "); } else if( $_post['scorethuis2'] > $_post['scoreuit2']) { //echo $_post["thuisteam1"]; mysql_query("update e2teams set punten = punten+3 team ='".$_post['thuisteam2']."'"); } else if( $_post['scorethuis2'] > $_post['scoreuit2']) { //echo $_post["thuisteam1"]; mysql_query("update e2teams set punten = punten+3 team ='".$_post['uitteam2']."'"); } else if( $_post['scorethuis2'] == $_post['scoreuit2']) { //echo $_post["thuisteam1"]; mysql_query("update e2teams set punten = punten+1 team in ('".$_post['thuisteam2']."', '".$_post['uitteam2']."') "); } ?>
thats weird logic have going on there, you're saying is:
$foo = 1 if($foo > 1) {//you'll skip this} else if($foo > 1) {//and this} else if($foo == 1) {//and here} $foo = 2 if($foo > 1) {//you'll here} else if($foo > 1) {//skip this} else if($foo == 1) {//and this} i'm not sure you're trying achieve consider revising
Comments
Post a Comment