findsurvey.php (716B)
1 <?php 2 include_once 'res/session.php'; 3 include_once 'config.php'; 4 include 'res/navbar.php'; 5 $sql = "SELECT access_code FROM survey ORDER BY RAND() LIMIT 1;"; 6 $result = mysqli_query($connect, $sql); 7 $rand_code = mysqli_fetch_assoc($result); 8 if(!isset($_SESSION['uid'])){ 9 header("location: login.php?user=notloggedin"); 10 exit; 11 }?> 12 <link rel="stylesheet" href="res/style.css"> 13 14 <form class ="find-survey-form" action="takesurvey.php" method="POST"> 15 <h2> Find Survey </h2> 16 <input type="text" name="survey-code" placeholder="Survey Code"> 17 <button type="submit" name="submit">Find Survey</button> 18 <?php 19 echo "<p> Looking for a survey? Try ", $rand_code['access_code'], "</p>"; 20 21 ?> 22