Sublime Forum

Weird Behaviour

#1

I created an HTML document with a form with 7 fields to be processed in a PHP script, like this:

if (empty($_POST["grupo"])) {
    die("El grupo terapéutico es requerido");
}
if (empty($_POST["principio"])) {
    die("El principio activo es requerido");
}
if (empty($_POST["concentracion"])) {
    die("La concentracion del producto es requerida);
}
if (empty($_POST["forma"])) {
    die("La forma farmaceutica es requerida");
}

Up to:

 if (empty($_POST["concentracion"])) {
    die("La concentracion del producto es requerida);
}

Everything looks as expected, the if has a violet color and the empty function is blue colored but the next one has a green color. When I run the the HTML and the PHP script this last statement is not even processed.
Also there is a comment below that after putting it among /* and */ should get a gray color but it is all green like the last sentence I mentioned above.
So this is not working, I wonder what may be wrong?
Thank you.

0 Likes

#2

I suggest asking in a forum dedicated to PHP or something more general like stack overflow; this is for Sublime Text support.

0 Likes

#3

I copied and pasted code that was already working, I simply added more fields to the form.
So It’s an issue with your editor, not with PHP.
Why don’t you do a little effort and try to provide a solution?

0 Likes

#4

You are missing a closing quote character in the argument of the 3rd die() function call.

0 Likes

#5

Thank you, my bad.
Anyhow, it would be interesting if the editor shows that there is an error like this which is not easy to spot.

0 Likes

#6

First of all syntax highlighting gets badly broken due to missing quote. So I find it pretty obvious. Beyound that, you could try LSP and LSP-intelliphense to get more intelligent linter warnings.

0 Likes