Advertisement
commandrea

checkbox results to html/email

May 20th, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. Selection.php
  2.  
  3.  
  4. <?php
  5.  
  6. $sql_Sat1 = "SELECT * FROM bandSched WHERE day='saturday' AND stage='stage 1'";
  7. mysql_query($sql_Sat1);
  8. $result_Sat1 = mysql_query($sql_Sat1);
  9.  
  10. while($row = mysql_fetch_array($result_Sat1))
  11. {
  12. echo "<ul><li>";
  13. echo'<input type="checkbox" name="id[]" value="'.$row['id'].' " id="bandSched_' . $row['id'] . '" />';
  14. echo '<label for="bandSched_' . $row['id'] . '">' . $row['timeShow']." ".$row['bandName'] . '</label>';
  15. echo "</li></ul>";
  16.  
  17. }
  18.  
  19.  
  20. ?>
  21.  
  22.  
  23.  
  24. Process.php
  25.  
  26. <?php
  27. if ( ! empty($_POST['id']))
  28. { foreach($_POST['id'] as $key => $id) { $_POST['id'][$key] = mysql_real_escape_string($_POST['id'][$key]); }
  29. $in = implode(', ', $_POST['id']);
  30. $sql_Sat1 = "SELECT * FROM bandSched WHERE id IN ($in) ORDER BY FIELD(id, $in)";
  31. $result = mysql_query($sql_Sat1) or die('MySQL Error ' . mysql_errno() . ': ' . mysql_error());
  32. }
  33. if ( ! isset($result))
  34. {
  35. echo 'You did not select anything';
  36. }
  37. else
  38. {
  39. while ($row=mysql_fetch_assoc($result))
  40. {
  41.  
  42. echo "<tr>";
  43. echo "<td>". $row['timeShow'] ."</td><td>" . $row['bandName'] . "</td>";
  44. echo "</tr>";
  45. }
  46.  
  47. }
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement