Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:07:28+00:00 2026-06-09T06:07:28+00:00

This was formed by TonyMancini , but I need help now. The form does

  • 0

This was formed by TonyMancini, but I need help now. The form does validate, but, it comes up with a new page that looks like

There were 57 errors in your submission, please correct them.

Please enter your first name

There were 57 errors in your submission, please correct them.

Please enter your last name

There were 57 errors in your submission, please correct them.

Please enter your 9 digit social security number

There were 57 errors in your submission, please correct them.

Please enter your phone number

There were 57 errors in your submission, please correct them.

Please enter your address

There were 57 errors in your submission, please correct them.

Please enter your city

etc.

Is it possible to have the errors show up next to my form fields? Or not?

<?php
// Create a dynamic array for the error messages and validate everything before sending them back to the form that shows them
// Here is a sample of your code with the dynamic array built in

$error_msgs = array ();
$error = 0; //Error flag

if ($_POST['first_name']){
$first_name = $_POST['first_name'];
} else {
$error_msgs[] = "Please enter your first name";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['last_name']){
$last_name = $_POST['last_name'];
} else {
$error_msgs[] = "Please enter your last name";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['ssn']){
$ssn = $_POST['ssn'];
} else {
$error_msgs[] = "Please enter your 9 digit social security number";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['phone']){
$phone = $_POST['phone'];
} else {
$error_msgs[] = "Please enter your phone number";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['address']){
$address = $_POST['address'];
} else {
$error_msgs[] = "Please enter your address";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['city']){
$city = $_POST['city'];
} else {
$error_msgs[] = "Please enter your city";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['state']){
$state = $_POST['state'];
} else {
$error_msgs[] = "Please select your state";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['zip']){
$zip = $_POST['zip'];
} else {
$error_msgs[] = "Please enter your 5 digit zip code";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['position']){
$position = $_POST['position'];
} else {
$error_msgs[] = "Please enter position desired, or type N/A if open for discussion";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['wage']){
$wage = $_POST['wage'];
} else {
$error_msgs[] = "Please enter 0.00 if open for discussion";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['Emergencycontactname']){
$Emergencycontactname = $_POST['Emergencycontactname'];
} else {
 $error_msgs[] = "Please enter your emergency contact's name";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['Emergencycontactaddress']){
$Emergencycontactaddress = $_POST['Emergencycontactaddress'];
} else {
 $error_msgs[] = "Please enter your emergency contact's address";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['Emergencycontactcity']){
$Emergencycontactcity = $_POST['Emergencycontactcity'];
} else {
 $error_msgs[] = "Please enter your emergency contact's city";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['Emergencycontactstate']){
$Emergencycontactstate = $_POST['Emergencycontactstate'];
} else {
 $error_msgs[] = "Please select your emergency contact's state";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['Emergencycontactzip']){
$Emergencycontactzip = $_POST['Emergencycontactzip'];
} else {
 $error_msgs[] = "Please enter your emergency contact's 5 digit zip code";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['Emergencycontactphone']){
$Emergencycontactphone = $_POST['Emergencycontactphone'];
} else {
 $error_msgs[] = "Please enter your emergency contact's phone number";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['highest']){
$highest = $_POST['highest'];
} else {
 $error_msgs[] = "Please enter your highest level of education";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['degree']){
$degree = $_POST['degree'];
} else {
 $error_msgs[] = "Please enter N/A if none";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['age']){
$age = $_POST['age'];
} else {
 $error_msgs[] = "Please enter yes or no";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['problems']){
$problems = $_POST['problems'];
} else {
 $error_msgs[] = "Please enter yes or no";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['shiftwork']){
$shiftwork = $_POST['shiftwork'];
} else {
 $error_msgs[] = "Please enter yes or no";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['apprenticeship']){
$apprenticeship = $_POST['apprenticeship'];
} else {
 $error_msgs[] = "Please enter yes or no";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['disabilities']){
$disabilities = $_POST['disabilities'];
} else {
 $error_msgs[] = "Please enter yes or no";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['ifyes']){
$ifyes = $_POST['ifyes'];
} else {
 $error_msgs[] = "If you answered no to above question, type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['accommodate']){
$accommodate = $_POST['accommodate'];
} else {
 $error_msgs[] = "Type N/A if you answered N/A for above question";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['experience']){
$experience = $_POST['experience'];
} else {
 $error_msgs[] = "Please enter yes or no";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['ifyes2']){
$ifyes2 = $_POST['ifyes2'];
} else {
 $error_msgs[] = "If you answered no to above, type N/A, otherwise describe";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cname']){
$cname = $_POST['cname'];
} else {
 $error_msgs[] = "Please enter company name";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['caddress']){
$caddress = $_POST['caddress'];
} else {
 $error_msgs[] = "Please enter company address";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cphone']){
$cphone = $_POST['cphone'];
} else {
 $error_msgs[] = "Please enter company phone number";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['ccperson']){
$ccperson = $_POST['ccperson'];
} else {
 $error_msgs[] = "Please enter company contact person's name";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['ctype']){
$ctype = $_POST['ctype'];
} else {
 $error_msgs[] = "Please enter type of work";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cwage']){
$cwage = $_POST['cwage'];
} else {
 $error_msgs[] = "Please enter wage earned";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cstart']){
$cstart = $POST['cstart'];
} else {
 $error_msgs[] = "Please enter date started";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cend']){
$cend = $POST['cend'];
} else {
 $error_msgs[] = "Please enter date ended";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['reason']){
$reason = $_POST['reason'];
} else {
 $error_msgs[] = "Please enter reason for leaving";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cname2']){
$cname2 = $_POST['cname2'];
} else {
 $error_msgs[] = "Please enter company name or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['caddress2']){
$caddress2 = $_POST['caddress2'];
} else {
 $error_msgs[] = "Please enter company address or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cphone2']){
$cphone2 = $_POST['cphone2'];
} else {
 $error_msgs[] = "Please enter company phone number or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['ccperson2']){
$ccperson2 = $_POST['ccperson2'];
} else {
 $error_msgs[] = "Please enter company contact person's name or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['ctype2']){
$ctype2 = $_POST['ctype2'];
} else {
 $error_msgs[] = "Please enter type of work or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cwage2']){
$cwage2 = $_POST['cwage2'];
} else {
 $error_msgs[] = "Please enter wage earned or type 0.00 if N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cstart2']){
$cstart2 = $POST['cstart2'];
} else {
 $error_msgs[] = "Please enter date started or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cend2']){
$cend2 = $POST['cend2'];
} else {
 $error_msgs[] = "Please enter date ended or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['reason2']){
$reason2 = $_POST['reason2'];
} else {
 $error_msgs[] = "Please enter reason for leaving or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cname3']){
$cname3 = $_POST['cname3'];
} else {
 $error_msgs[] = "Please enter company name or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['caddress3']){
$caddress3 = $_POST['caddress3'];
} else {
 $error_msgs[] = "Please enter company address or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cphone3']){
$cphone3 = $_POST['cphone3'];
} else {
 $error_msgs[] = "Please enter company phone number or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['ccperson3']){
$ccperson3 = $_POST['ccperson3'];
} else {
 $error_msgs[] = "Please enter company contact person's name or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['ctype3']){
$ctype3 = $_POST['ctype3'];
} else {
 $error_msgs[] = "Please enter type of work or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cwage3']){
$cwage3 = $_POST['cwage3'];
} else {
$error_msgs[] = "Please enter wage earned or type 0.00 if N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cstart3']){
$cstart3 = $POST['cstart3'];
} else {
$error_msgs[] = "Please enter date started or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['cend3']){
$cend3 = $POST['cend3'];
} else {
$error_msgs[] = "Please enter date ended or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['reason3']){
$reason3 = $_POST['reason3'];
} else {
$error_msgs[] = "Please enter reason for leaving or type N/A";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['maywe']){
$maywe = $_POST['maywe'];
} else {
$error_msgs[] = "Type names of companies you do not want us to contact, or type, ok all";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['additional']){
$additional = $_POST['additional'];
} else {
$error_msgs[] = "Type N/A if you do not have any additional information";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['electronicsignfn']){
$electronicsignfn = $_POST['electronicsignfn'];
} else {
$error_msgs[] = "Please enter your full name";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['electronicsignssn']){
$electronicsignssn = $_POST['electronicsignssn'];
} else {
$error_msgs[] = "Please enter your 9 digit social security number";
$errors++; //Flag to let the code know that there are errors, used in every case
}

if ($_POST['emailaddress']){
$emailaddress = $_POST['emailaddress'];
} else {
$error_msgs[] = "Please enter your email address";
$errors++; //Flag to let the code know that there are errors, used in every case
}

// Finally at the end, check to see if there are any errors and display them all
if ($errors > 0) {
// Display your error array
foreach (    $error_msgs as &$msg) {
echo "There were " . $errors . " errors in your submission, please correct them.<br/>";
echo $msg . "<br/>";
}
} else {
// Add code here to submit the form however you'd like
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:07:30+00:00Added an answer on June 9, 2026 at 6:07 am

    Your conditional tests are most likely going to evaluate to false everytime. You probably need to test with isset() or empty() like this:

    if (isset($_POST['field'])) {
        // a value was posted
    } else {
        // error
    }
    

    or

    if (!empty($_POST['field'])) {
        // a value was posted
    } else {
        // error
    }
    

    It is possible to have the errors show up next to your input fields, but you need to work on first things first, which is to get your form working correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was under the impression that this was formed correctly, but here it is
I'm very new to Scheme and I'm getting an ill-formed special form error when
OK, this one is driving me nuts.... I have a string that is formed
I have some xml that looks like this: <rootElement attribute=' > '/> This is
This is an abstracted form of the bug that led me into the code
I have different php output in jQuery-based tabs. This output is formed from database
I'm doing a jQuery AJAX post like this: var form = $(#formid); form.submit(function() {
I'm making a request to an old server that serves up ill-formed JSON. It's
Is this a valid (well-formed) XML document? <?xml version=1.0 encoding=UTF-8 ?> <outer> <inner>&copy;</inner> </outer>
This is kind of a strange one. I have a CSV that I'm uploading

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.