tags:

views:

62

answers:

4

Hello, I really can't find the error. Here is my code:

<?
// Action: add news
    if( array_key_exists('create_new', @$_POST) )
    {
?>
  ...
<?
    exit();
    }
?>

Before this my problem was in construction: <?=...;?> My apache doesn't understand it so that I rewrited code without that. But now I really can't find solution.

+1  A: 

Add a space before the ? and after the ; here:

$_SERVER['REQUEST_URI'];?>

Replace all <? by <?php

powtac
Okay, but why? All time before I used <? not <?php. Could I enable this?
Ockonal
Its in the php.ini search for short_tags or similar.
powtac
I don't see how this can be a short tags issue: the implication of changing <? to <?php is that it's in short tags form and therefore not being parsed by PHP, which is obviously not the case as otherwise the code would just be returned to the browser, as opposed to the error "unexpected $end in php" (which I assume is what the OP is getting, according to the question title).
Narcissus
A: 
GSto
+1  A: 

@$_POST should just be $_POST

R. Bemrose
In real code I'm using $_POST. I just tested code.
Ockonal
A: 

You're apparently missing a close brace. I hate to say it, but without the complete code, it's pretty hard for us to tell you where the problem is... so either I think we need to see the complete code, or you'll have to sit down with a decent editor and trace the opening and closing braces.

Narcissus