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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:22:45+00:00 2026-06-12T21:22:45+00:00

My issue is I have a PHP $_POST that returns a null or empty

  • 0

My issue is I have a PHP $_POST that returns a null or empty value, and I personally do not see any error with my code (but I know its there) and I can’t really step away from it for a few hours since I am on a time schedule. So, I was hoping someone could help me out 😉

Here is what I have, basically:

<table border="0" align="center">
<tr>
    <td>
        <div id="lvl3">Project Name:</div>
    </td>
    <td>
        <input type="text" name="prjname" maxlength="250">
    </td>
</tr>
<tr>
    <td colspan="2" align="center">
        <input type="submit" value="Submit" name="prjsubmitname">
        <input type="button" value="Cancel" onclick="$('#popupoverlay').hide(); $('#prjpopupbox').hide(); $('#prjname').hide(); $('#prjdescription').hide(); $('#prjversion').hide(); $('#prjrelease').hide();">
    </td>
</tr>

This is my table for editing a project name- what is important here is the textbox input, I think.

Next I have my PHP:

//Did the user change the Project Name
if (isset($_POST['prjsubmitname']))
{
//Is the input empty
if (!trim($_POST['prjname']))
{
    //Input is empty
    echo('<script>senderror("Please enter a valid Project Name empty");</script>');
} else {

    //Input isnt empty, assign variables
    $url = geturlext();
    $prjname = mysql_real_escape_string(trim($_POST['prjname']));

    //Is input invalid
    if (strcasecmp($prjname, "main") == 0 | $prjname == "404")
    {
        //Input is invalid
        echo('<script>senderror("Please enter a valid Project Name invalid");</script>');
    } else {

        //Input is valid, connect to database
        dbconnect();

        $checkquery = mysql_query("SELECT * FROM projects WHERE name = '$prjname'") or die(mysql_error());
        $check = mysql_num_rows($checkquery);

        //Does Project Name already exist
        if ($check == 0)
        {
            //No it does not
            $updatequery = mysql_query("UPDATE projects SET name = '$prjname' WHERE name = '$url'") or die(mysql_error());

            echo("<script>location.href='index.php?page=" . $prjname . "'</script>");
        } else {
            //Yes it does
            echo('<script>senderror("That Project Name already exists");</script>');
        }
    }
}
}

This is where I get my issue; No matter what I enter in the textbox, I always get the error message for ‘Input is empty’. I have printed the output of $_POST[‘prjname’] and it is indeed empty.

Now the weird part is, I have this exact same (at least I think) setup for changing the project description, and it works flawlessly. For the sake of comparison- i’ve included the same parts of the project description editor below.

The table:

<table border="0" align="center">
<tr>
    <td>
        <div id="lvl3">Project Description:</div>
    </td>
    <td>
        <textarea type="text" name="prjdescription" maxlength="750" style="width:300px; height:100px; resize:none;"></textarea>
    </td>
</tr>
<tr>
    <td colspan="2" align="center">
        <input type="submit" value="Submit" name="prjsubmitdescription">
        <input type="button" value="Cancel" onclick="$('#popupoverlay').hide(); $('#prjpopupbox').hide(); $('#prjname').hide(); $('#prjdescription').hide(); $('#prjversion').hide(); $('#prjrelease').hide();">
    </td>
</tr>

And the PHP:

//Did the user change the Project Description
if (isset($_POST['prjsubmitdescription'])) 
{
//Is the input empty
if (!trim($_POST['prjdescription']))
{
    //Input is empty
    echo('<script>senderror("Please enter a valid Project Description");</script>');
} else {

    //Input isnt empty, do stuff
    $url = geturlext();
    $prjdescription = mysql_real_escape_string(trim($_POST['prjdescription']));

    //Connect and change description
    dbconnect();

    $updatequery = mysql_query("UPDATE projects SET description = '$prjdescription' WHERE name = '$url'") or die(mysql_error());
    echo("<script>location.href='index.php?page=" . $url . "'</script>");
}
}

For clarification, both tables are in the same form tag, and the PHP is right next to eachother.

No errors on Firebug, matter of fact Firebug doesn’t give me anything. Other than that, I’m sure it’s some really small typo that I am overlooking.

  • 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-12T21:22:46+00:00Added an answer on June 12, 2026 at 9:22 pm

    I have found a solution to this issue:

    Renaming the variable ‘$prjname’ in the Project Name editing PHP fixes the issue.

    It would seem that having a variable ($prjname) with the same name as a $_POST ([‘prjname’]) returns an empty or null string. No idea why.

    Thanks to those who tried to help

    EDIT: Actually, I get the error again if I only change the variable name ($prjname)- It only fixes when I change the $_POST name… Odd.

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

Sidebar

Related Questions

So I'm not to OOP in PHP. Here is my issue I have a
I have an issue with php where code works on on computer but wont
I have a simple XML extraction issue that should be solvable with straight PHP
I have some issues with a PHP file that is not working properly. The
I have a login form using jquery ajax and a php code. The issue
I have an issue going on here. I am using PHP to get values
I have an issue where, after installing SOAP for PHP 5.3, I have no
I have this common issue of 'new line' in php-csv which is making me
I'm just starting with Object Oriented PHP and I have the following issue: I
all. I have built a simple jQuery/PHP chat program that works rather well. However,

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.