-11

Question is deleted now. Screenshot below:

Undefined index PHP with _POST

Original question

I was about to answer this question: https://stackoverflow.com/questions/60871550/undefined-index-php-with-post but it was flagged as off-topic, I guess the criteria was Typo error based on this:

printHex($_POST['color']); // All lowercase color

?>

<form action="colorshex.php" method="post">
Color: <input type="text" name="Color"> <br> <!-- First uppercase Color -->
</form>

Yeah, there is a typo error there, but also a logic error, because OP is trying to access an element of a form that is not submitted on the first script execution, so fixing typo would not fix the problem.

I guess flags came from non-PHP users.

Now, my questions:
- How can we avoid to flag questions that are valid?
- How a simple and mortal user like me can ask to reopen a question?

I've just noticed why I was not satisfied on how question was flagged and closed: I've just saw another question that was duplicated and a user with more than 60k score answered instead of flagged it as duplicate.

I won't say names because that's not really important, the matter is that there is no just one way to do things here, even experts can make mistakes, not just newbies like me.

I was wrong trying to answer instead searching if the question has been answered before, but let me explain better:

The matter here is about criteria, the question was flagged because a typo, but fixing typo won't solve the issue and it was clear if you look a little deeper in the code.

I've found some similar questions but I usually wait to flag until OP says that fixing typo solved the issue, because a lot of people doesn't copy/paste their real code and they can easily make a mistake.

So, in order the OP can learn something and avoid new questions about the same issue, the best we could do is pointing him in the right direction, in this case, that was flagging the question as duplicate.

11
  • For the records: The author deleted the question. This was not a moderator action.
    – BDL
    Mar 26, 2020 at 16:53
  • For the records: he was asking for help in comments and I told him that we're not able to answer because question was closed.
    – Triby
    Mar 26, 2020 at 16:56
  • 1
    Hmm. The way how I read the comment thread is that you told the user to ask a new question for the new problem they had after fixing the one in this question. For the isset issue: Probably a duplicate of this.
    – BDL
    Mar 26, 2020 at 17:03
  • 5
    "I told him that we're not able to answer because question was closed." Thing is, that's not necessarily true. For questions that aren't duplicates or hopelessly off-topic, the point of closing them is so that they don't attract bad answers before the OP can edit it into better shape, and then it can potentially be re-opened. In this case, it would have stopped any potential answers from focusing entirely on the typo instead of the logic error, and if the OP had fixed the typo and edited their question to focus on the latter problem it might have been able to get re-opened and answered. Mar 26, 2020 at 17:14
  • 2
    FYI, re: "I guess flags came from non-php users", the initial close voter has a score of over 4000 in php. They are most definitely an expert PHP user.
    – TylerH
    Mar 26, 2020 at 17:43
  • @TylerH, do you know what guess means? I'm not attacking anyone, I was just thinking why that question was closed and @yivi was pretty clear on that.
    – Triby
    Mar 26, 2020 at 18:00
  • @Triby I didn't say you were attacking anyone; I'm just giving you some information so that you don't have to guess (incorrectly).
    – TylerH
    Mar 26, 2020 at 18:41
  • 2
    I'm not sure why this is being close-voted as "can no longer be reproduced." Sure, the specific question referenced was deleted, but the concerns here are more general. Mar 26, 2020 at 18:53
  • 1
    No, the question was a typo. The best possible course of action was to vote to close as a typo. You can help the user with a comment about their typo if you want, but closing these questions as dupes is not helpful in the long term. We do not need thousands of trivial questions pointing to the same canonical answer. You are taking away the wrong conclusion from this.
    – yivi
    Mar 27, 2020 at 6:51
  • 1
    @yivi I'm referring to this meta question, not the original one. Mar 27, 2020 at 17:04
  • 1
    @John, I was not replying to you but to the question asker. I voted to reopen this que question.
    – yivi
    Mar 27, 2020 at 17:17

1 Answer 1

12

The way to reopen a question is always the same: edit the question so the closure reasons no longer apply, if at all possible.

That particular question was not salvageable, I am afraid. And I do have some PHP experience, so dismissing my opinion as a "non-PHP user" as you are doing with the original close-voters would not be adequate.

The original question was predicated on a typo. Those questions are not useful for future visitors. At best, it could have been closed as a dupe of the canonical question for this type of issue.

It is true once that particular hiccup was solved maybe a different question could be asked, but there is not much going on there that's worth salvaging.

You seem to assume that the problem is that they are trying to access the $_POST super-global before submitting the form, but reading the comments that doesn't appear to be the case. They say:

but now when I press enter I've nothing in output :/

Since what they have is a form with method="POST", pressing enter with the input focused would cause the form to be sent. Assuming the script in the action is the same script the user shows in the question... the value should be sent.

So the problem is somewhere else. And at best users can try to guess where exactly, as you are trying to do, and as I'm trying to do with my assumptions above.

If all we have are guesses, then the question is unclear, and should be closed. But let's not kid ourselves, when all the uncertainties of this question are resolved, you would be left with a simple typo question nonetheless, which would help the asker and no one else.

Closing and deleting was the way to go. If they work diligently to create a reproducible example, they'll find the root cause of their problem and fix it themselves.

1
  • 1
    Great answer, now I have a better perspective on how thing works. I'me here since a couple of years ago and I'm still learning, thanks for your help.
    – Triby
    Mar 26, 2020 at 17:28

Not the answer you're looking for? Browse other questions tagged .