process_newpoll.php 548 B

123456789101112131415161718192021222324
  1. <?php
  2. require_once("./common.php");
  3. $title = $_POST['title'];
  4. $description = $_POST['description'];
  5. $name = $_POST['name'];
  6. if (isset($_SESSION['user']))
  7. $ownerid = $_SESSION['user']['id'];
  8. else
  9. $ownerid = 0;
  10. $query = sprintf("INSERT INTO polls (title ,description, name, owner_id) VALUES ('%s' , '%s', '%s', $ownerid);",
  11. mysql_real_escape_string($title),
  12. mysql_real_escape_string($description),
  13. mysql_real_escape_string($name)
  14. );
  15. mysql_query($query);
  16. header("Location: poll_options.php?poll_id=" . mysql_insert_id());
  17. ?>