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 Posted / 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 |
Post New Answer View All Answers
List some features of php that are deprecated in php7?
What is the current stable version of php?
What does $_files means?
if you run the app program all vendor open items are cleared but is it possible to reverse the again again open items please tell me the answer
What sized websites have you worked on in the past?
What is the difference between htmlentities() and htmlspecialchars()?
sort term descripttion form, report and uery
hello all, I need some sample placement papers in lion bridge.. can anyone help me?
how to detect a mobile device using php
How can we extract string "pcds.co.in" from a string "https://info@pcds.co.in" using regular expression of php? More on reg can you explain
What is trait in php?
Explain me is it possible to destroy a cookie?
Tell me what kind of things have you done on the social side?
How to create a web form?
Write a program using while loop?