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

  • SEARCH
  • Home
  • 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 8815107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:17:35+00:00 2026-06-14T04:17:35+00:00

I have a textarea that I am trying to validate whether someone has filled

  • 0

I have a textarea that I am trying to validate whether someone has filled out or not before submitted the form. I’m doing all of my validation server side with PHP.

I had two thoughts. Either:

1) submit the form to itself and have the fields validate themselves on the same page and then redirect to the page where the form would update my database. The problem I had was that since it was posting to itself, once the page redirected, I couldn’t carry out using the POST values because they were no longer valid.

2) So I figured I’d just do the validation on the second page (the page that the form initially is set to post to). Here’s my code for that page, where ‘description’ is the name of the textarea:

session_start();
if(!$_POST['description']){
echo "<script>alert(\"Please fill out all fields\");</script>";
header("location:post_job.php");
}

And then it redirects back to the page where the form is being filled. I get this error though:

Warning: Cannot modify header information - headers already sent by (output started at siteinfo/site/checkjob.php:4) in siteinfo/site/checkjob.php on line 5

Line five is the header line (so line four is obviously the echo line). I don’t understand why it would create that error since I haven’t sent a header yet. Any help would be greatly appreciated. Thanks!

  • 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-14T04:17:36+00:00Added an answer on June 14, 2026 at 4:17 am

    Try this

    session_start();
    if(!$_POST['description']){
    echo "<script>alert(\"Please fill out all fields\");";
    echo "window.location.href='post_job.php';";
    echo "</script>";
    }
    

    Although I must add the way you intend to show your message isn’t in a good manner. Validating through Ajax or javascript before the form is submitted is a good route to follow. Keep this way as a backup plan in case javascript is disabled on the client’s system.

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

Sidebar

Related Questions

I have a textarea in a form that im trying to POST into a
I currently have a label that is absolute positioned within a textarea. I'm trying
I have a form with a textarea that can contain large amounts of content
I have a textarea. I am trying to check that it contains atleast 3
I am trying to have a textarea that can have some simple styling like
I have this textarea form: self.response.out.write( <form name=title action=/edittitlepitchhandler method=post> ... pitch: <br />
I have a textarea that I might want to disable in certain conditions. I
I have a textarea that I'm able to edit with the jeditable plugin but
I have a textarea that is used as the body of an email sent
I have an HTML textarea that is of fixed width, but variable height. I

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.