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 8291899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:17:11+00:00 2026-06-08T13:17:11+00:00

Hello, I have a short question. I would like to reset a variable that

  • 0

Hello, I have a short question. I would like to reset a variable that is going to be posted:

I will post a variable that comes from an input field. When this variable $_POST['a']; is empty, I would like to fill it with new content.

The scheme is like that:

empty variable will be posted -> php recognizes that it is empty -> giving it new content -> echoing out new content.

This is just simple but it doesnt work for me.

So here is what I have:

$a = $_POST['a'];

if( empty($a){
    $errors['a'][]="text";
    $a =="new content";
}

So if there is someone whould could tell me whats being wrong with this, I really would appreciate. Thanks a lot.

  • 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-08T13:17:13+00:00Added an answer on June 8, 2026 at 1:17 pm

    Three things:

    $a = isset($_POST['a']) ? $_POST['a'] : ''; // always check if array index exists
    
    if( empty($a)) { // one more bracket
        $errors['a'][]="text";
        $a ="new content"; // only one '='
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have a datatable that I would like to filter with a single
Sorry to post another question that is similar to the question that I posted
We have a question we ask at our office during interviews that goes like
I have an NSString like @Hello World and want to convert that into an
hello I have this code that use to sort a datatable. Dim sortingIndex As
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
hello i have this question i was trying to find a way to call
hello I have my code that connects to my ftp server $conn_id = ftp_connect($ftp_server);
Really simple question time: I have two divs. <div id=1> <p>hello</p> </div> <div id=2>
This is going to be a real noob question, so please have mercy. 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.