Advertisement
Guest User

Untitled

a guest
Dec 27th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1.  
  2. <select class="form-control" name="storeselect" required="" size="1">
  3. <option value=''>
  4. Select Store
  5. </option><?php
  6. $servername = "localhost";
  7. $username = "root";
  8. $password = "";
  9. $db = "storeinfo";
  10.  
  11. // Create connection
  12. $conn = new mysqli($servername, $username, $password, $db);
  13.  
  14. // Check connection
  15. if ($conn->connect_error) {
  16. die("Connection failed: " . $conn->connect_error);
  17. }
  18.  
  19. $db = new mysqli($servername, $username, $password, $db);
  20. $queryusers = "SELECT * FROM `information` WHERE `storelist` !='Security' ORDER BY `storelist` ASC";
  21. $db = mysqli_query($db, $queryusers);
  22. while ( $d=mysqli_fetch_assoc($db)) {
  23. //checking and formatting the mailto code just in case any field is blank.
  24. $manager = $d['manager'];
  25. $director = $d['director'];
  26. $sdirector = $d['sdirector'];
  27. // if there is no manager then only email the director and senior director
  28. if ($manager == "none"){
  29. $email = $director."?CC=".$sdirector;}
  30. //if there is no director just email the manager and senior director
  31. elseif ($director == "none") {
  32. $email = $manager."?CC=".$sdirector;
  33. }
  34. else {
  35. // if all three emails exist run the standard email code
  36. $email = $manager."; ".$director."?CC=".$sdirector;
  37. }
  38. // list all stores in a dropdown with the id being the email code so it dynamically loads into the submit button
  39. echo "
  40. <option value ='".$d['storelist']."' title ='".$d['name']."' id='".$email."'>".$d['storelist']."</option>";
  41. }
  42. ?>
  43. </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement