process_poll_options.php 527 B

123456789101112131415161718192021222324
  1. <?php
  2. require_once("./common.php");
  3. $index = 0;
  4. $poll_id = $_GET['poll_id'];
  5. foreach ($_POST['choice'] as $choice){
  6. $value = 1<<$index++;
  7. $choice = urlencode($choice);
  8. $query = "INSERT INTO poll_options VALUES ('$poll_id', '$choice', '$value');";
  9. mysql_query($query);
  10. }
  11. $maxselect = $_POST['maxselect'];
  12. if (is_numeric($maxselect) && $maxselect != false) {
  13. $query = "UPDATE polls SET maxselect='$maxselect' where id='$poll_id';";
  14. mysql_query($query);
  15. }
  16. header("Location: poll.php?poll_id=" . $poll_id);
  17. ?>