PDA

View Full Version : Why am I getting this error...


Dark_Wizard
07-04-2003, 11:01 AM
It's only on some sites and it's driving me nuts...

The error is:
Parse error: parse error, expecting `']'' in /home/heroclan/public_html/forums/vchallenge.php(172) : eval()'d code on line 303


and here is the offending line in the template:
<option value="12:00" $wartimeselected[12:00]>12:00</option>

and the PHP code:

if(isset($HTTP_POST_VARS["wartime"])) $wartimeselected[$HTTP_POST_VARS["wartime"]]="selected";

It doesn't like this [12:00] anyone know why?

noppid
07-04-2003, 01:10 PM
My guess is it don't like the : in the array element name.

Dark_Wizard
07-04-2003, 01:16 PM
Today at 10:10 AM noppid said this in Post #2 (https://vborg.vbsupport.ru/showthread.php?postid=415247#post415247)
My guess is it don't like the : in the array element name.


But why only certain sites? All are using PHP 4.2.3...

noppid
07-04-2003, 01:28 PM
I have no idea.

I tried the : in php Expert editor. The colon causes a syntax error.
Lose the : in the element array names.

Dark_Wizard
07-04-2003, 01:40 PM
Today at 10:28 AM noppid said this in Post #4 (https://vborg.vbsupport.ru/showthread.php?postid=415252#post415252)
I have no idea.

I tried the : in php Expert editor. The colon causes a syntax error.
Lose the : in the element array names.

Then I would have to do seperate months and days in the dropdown and then implode it...

Dean C
07-04-2003, 02:34 PM
if( isset( $HTTP_POST_VARS['wartime'] ) )
{
$wartimeselected["$HTTP_POST_VARS['wartime']"]="selected";
}


Try that ^^

If the extra double quotes don't work try single quotes. I think it's double quotes though on keys with variables in :)

- miSt

Dark_Wizard
07-04-2003, 07:42 PM
Today at 11:34 AM Mist said this in Post #6 (https://vborg.vbsupport.ru/showthread.php?postid=415270#post415270)

if( isset( $HTTP_POST_VARS['wartime'] ) )
{
$wartimeselected["$HTTP_POST_VARS['wartime']"]="selected";
}


Try that ^^

If the extra double quotes don't work try single quotes. I think it's double quotes though on keys with variables in :)

- miSt

Tired it and it doesn't work get a "unexpected T_Variable"...whats funny is that in the admin piece it works fine...