Suppose we receive a form submitted by a post to subscribe to a newsletter. This form has only one field, an input text field named email. How would we validate whether the field is empty? Print a message "the email cannot be empty" in this case?
Answer / Uttam Kumar Singh
In PHP, you can use the $_POST superglobal array to access the submitted data. To check if the 'email' field is empty, you can use the empty() function: if(empty($_POST['email'])) { echo "the email cannot be empty"; }
| Is This Answer Correct ? | 0 Yes | 0 No |
How to read the entire file into a single string?
What are the ways we can destroy a session variable ?
Would you initialize your strings with single quotes or double quotes?
What are the two types of variables?
In what are the ways you can encrypt the password ?
What is php and how do you use it?
How do you find the length of a string in php?
If the variable $a is equal to 5 and variable $b is equal to character a, what’s the value of $$b? Can anyone explain how's the value of $$b=100
15 Answers ABC, Asan, Indivar, Swistro Marketing Solutions,
What is the difference between get & post ?
Is php faster than python?
Where is session value stored?
client side scripting language Vs server side scripting language