PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if (!$name) {echo "You must enter your full name. Please "; } else {
if (!$age) {echo "We need your Age. "; } else {
if (!$email) {echo "We must know your e-mail address to get back to you."; } else {
if (!$city) {echo "Please fill out the location section. "; } else {
if (!$state) {echo "Please fill out the state section. "; } else {
if (!$qualify) {echo "You didn't tell us why you are qualified. ";} else {
if (!$other) {echo "Please tell us why we should pick you over someone else. "; } else {
if (!$sales) {echo "Please tell us how you would approach sales. "; } else {
how do i make it so it collects all the unfilled/empty variables into 1 echo?
Example: Name, Email and State isnt filled out, echos back "Please fill out your: name, email and state"
Push each empty one into an array. A bit of logic will then be applied on the number of elements in the array. Where the number of elements is greater than one, the last element is popped off followed by the rest being imploded and finally the popped element is concatenated onto the string with "and" added.