<?php session_start(); include("connect.php"); $query = "SELECT * FROM test ORDER BY `id` ASC LIMIT 2"; $result = mysql_query($query); echo "<h2>Seria A</h2><hr/>"; while($row = mysql_fetch_array($result)) { $id = $row['id']; $home = $row['home']; $away = $row['away']; $win = $row['win']; $draw = $row['draw']; $lose = $row['lose']; echo "<br/>",$id,") " ,$home, " - ", $away; echo " <form action='seria.php' method='post' id='$id'> <input type='radio' name='select' value='1'>1 <input type='radio' name='select' value='X'>X <input type='radio' name='select' value='2'>2 <input type='hidden' name='id' value='".$row['id']."'/> <input type='submit' name='submit<?php echo $id; ?>' value='Submit'/> <br/> </form>"; echo "Totali ", $sum = $win + $lose + $draw, "<br/><hr/>"; } if (!empty($_POST)) { $id=isset($_POST['id'])&&is_numeric($_POST['id']) ? $_POST['id']:false; $select = isset($_POST['select']) ? $_POST['select']:false; switch ($select) { case 1: $select = $win + $select; mysql_query("UPDATE test SET win='$select' WHERE id='$id'"); break; case 'X': $select = '1'; $select = $draw + $select; mysql_query("UPDATE test SET draw='$select' WHERE id='$id'"); break; case 2: $select = '1'; $select = $lose + $select; mysql_query("UPDATE test SET lose='$select' WHERE id='$id'"); break; default: } header('Location: ../seria.php'); } ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)