Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this question//register users
$username= mysqli_real_escape_string($db, $_POST['username']);
$email= mysqli_real_escape_string($db, $_POST['email']);
$password1= mysqli_real_escape_string($db, $_POST['password1']);
$password2= mysqli_real_escape_string($db, $_POST['password2']);
//form validation
if(empty($username)){array_push($errors, "Username is required")};
if(empty($email)) {array_push($errors, "Email is required")};
if(empty($password)) {array_push($errors, "Password is required")};
Closed. This question is off-topic. It is not currently accepting answers.
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this question//register users
$username= mysqli_real_escape_string($db, $_POST['username']);
$email= mysqli_real_escape_string($db, $_POST['email']);
$password1= mysqli_real_escape_string($db, $_POST['password1']);
$password2= mysqli_real_escape_string($db, $_POST['password2']);
//form validation
if(empty($username)){array_push($errors, "Username is required")};
if(empty($email)) {array_push($errors, "Email is required")};
if(empty($password)) {array_push($errors, "Password is required")};
Share
Improve this question
edited May 19, 2020 at 0:05
Tony Djukic
2,2774 gold badges18 silver badges34 bronze badges
asked May 18, 2020 at 22:09
RaluRalu
1
2
- Can you provide a bit of context with your code? – Tony Djukic Commented May 19, 2020 at 0:04
- 1 This doesn't appear to be a WP question, you should ask general PHP questions on stackoverflow – Tom J Nowell ♦ Commented May 19, 2020 at 0:05
1 Answer
Reset to default 1The semi-colons need to go inside the curly braces, to mark the ends of the array_push() statements:
if(empty($username)) { array_push($errors, "Username is required"); }
if(empty($email)) { array_push($errors, "Email is required"); }
if(empty($password)) { array_push($errors, "Password is required"); }
You don't need semi-colons after the close braces.