Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <form method="post">
  2. First name:<br>
  3. <input type="text" name="firstname" autocomplete="on" maxlength="10" required><br>
  4. Last name:<br>
  5. <input type="text" name="lastname" autocomplete="on" maxlength="10" required><br>
  6. Employee number:<br>
  7. <input type="text" name="empnum" maxlength="10">
  8. <br>
  9. <br>I agree to the terms above:<br>
  10. <input type="checkbox" name="check" required>
  11. <button type="submit" asp-page-handler="SubmitAndRedirect">Submit and Redirect</button>
  12. </form>
  13.  
  14. public ActionResult OnPostSubmitAndRedirect()
  15. {
  16.  
  17. //Capture Form Data and Push to SQL DB
  18. var firstname = Request.Form["firstname"];
  19. var lastname = Request.Form["lastname"];
  20. var empnum = Request.Form["empnum"];
  21.  
  22. bool isValidUser = ValidateUser(empnum, lastname);
  23.  
  24. if (isValidUser == true)
  25. {
  26. WriteToDB(firstname, lastname, empnum, url);
  27. return Redirect(hardcoded);
  28. }
  29. else
  30. {
  31. return Redirect("/sign");
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement