Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. class Check {
  2. public function mty() {
  3. global $required;
  4. global $field;
  5.  
  6. foreach($required as $field) {
  7. if (empty($_POST[$field])) {
  8. //Code...
  9. } else {
  10. echo "Good";
  11. }
  12. }
  13. }
  14. }
  15.  
  16. $check = new Check;
  17.  
  18. //Gets names of inputs
  19. $required = array('name', 'price', 'id');
  20.  
  21. if(isset($_POST['submit'])) {
  22. $check->mty();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement