Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,165,216 members, 7,860,370 topics. Date: Friday, 14 June 2024 at 10:03 AM

Zhully's Posts

Nairaland Forum / Zhully's Profile / Zhully's Posts

(1) (of 1 pages)

Programming / How To Validate A Form In PHP by Zhully: 1:51pm On Nov 08, 2020
Hello nairalanders, I know some of you think PHP is old and outdated, but to be sincere, PHP powers most websites in the world. It will be a great opportunity for you to learn this programming language.

I will be posting more on PHP and will be glad if you can visit my blog for more. https://zhullyblogg..com/p/php-tutorial-zhullyblog.html?m=1
Now, the tutorial.

What is validation?
When we talk about validation, we are talking about checking whether the user enters an input correctly. Let's take a form for instance. When you create a form, you need user to enter either their name correctly, enter their email correctly, - and the only way to do this is by validating the form. So if the user fails to enter input correctly, the form is redisplayed with an error message.

There are several inputs that you need to validate in a form such as name , Email address etc.
Let's break it down



PHP - Validate name
A name will contain letters and whitespace. The name could be uppercase or lowercase letters. So, if the user fail to enter correctly, it will display an error message.
Here is the code.
statement.




$name =
test_input($_POST["name"]);
if (!preg_match("/^[a-zA-Z]*$/",$name)) {
$nameErr ="Only letters are allowed";
}



Note: The preg_match( ) function will return true if the input meets the condition and false if it fails to meet the condition.



PHP Validate Email
To validate email ( to check whether the input matches email pattern) , you use the filter_var( ) function. So if the email entered does not meet the requirements, an error message will be displayed.



$email =
test_input($_POST["email"]);
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "Invalid Email";
}

Read more on validation.
https://zhullyblogg..com/2020/06/php-form-validation-how-to-validate.html?m=1
Programming / Java Syntax by Zhully: 8:08am On Nov 07, 2020
I know some geeks know this already, but for the sake of new dev, here's a detailed explanation of Java Syntax. I hope this help.

You will learn the anatomy of Java. We would use a simple example which is "Hello world" to explain Java anatomy. This tutorial covers the syntax and semantics of Java program.


Here's the code


public class FirstJavaProgram {

public static void main(String[] args){

System.out.println("This is my first program in java"wink;

}//End of main

}//End of FirstJavaProgram


Explanation

Take a good look at the line of code above. Don't worry, I know it looks hard but don't worry let's break it down. All you need is a Java code editor and a cup of coffee.

Let's get started.



Step 1

Download a code editor on your Windows or Mac , save your program as helloWorld.java

You may be wondering why I asked you to save as HelloWorld.java. Well in Java, the name of the program must be the same as the one in public class name. Take a look at this.



Now let's take a good look at the program itself.



The class Heading

Let's take a closer look at this class Heading.

public class HelloWorld



This particular line is called the class heading that defines the program class. We will talk about class later in other tutorials.



The first two world before HelloWorld -- 'public' and 'class' are reserved words or simply keywords. By reserved word, we mean words that have been predefined by Java to serve a purpose. So those word are very important.



The last word on the line -- HelloWorld is the name of name of class. Please take note that you can choose any class name of your choice.



The main method heading

public static void main ( String [ ] args)



Public -- is an access modifier. This means that it is accessible by the public

Static -- allows the method to be accessed immediately.

Void -- this word indicates that the method returns nothing.

Braces

In Java, braces are very important. They come in pairs.

System.out.println

This line tells the computer to print something. The world to be printed will appear in the bracket and quoted.

You can visit my blog https://zhullyblogg..com/p/complete-java-tutorial-zhullyblog.html?m=1 , I have covered a lot of Java, HTML, JavaScript, PHP , Python tutorials.


Word of advice: There is no age limit to start learning programming.

Programming / Introduction To Java8 Programming by Zhully: 9:38am On Nov 06, 2020
Java is a simple programming language created by James Gosling from Sun Microsystems in 1991. Sun Microsystems was later acquired by Oracle Corporation.

The first public version of Java was Java 1.0 released in 1995.

The current version of Java is 1.8 widely known as Java8. The basic idea of Java is to write code once and run it on several operating system.





Why Java ?

There are so many questions to be asked when you want to learn Java and the first question is -- why do I have to learn Java. Well here are the some reasons why you should learn JAVA.

1) Simplicity

When we talk of simplicity, Java is one of the programming language that inherits this features.Click on the link to learn more.
https://zhullyblogg..com/2020/10/introduction-to-java-programming.html?m=1

(1) (of 1 pages)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 25
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.