Jump to content

unexpected T_ELSEIF

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Okay mates..
I get this error:

Quote

Parse error: syntax error, unexpected T_ELSEIF in /home/****/****/****/****/****/index.php on line 384

here's my function:

[HIGHLIGHT="PHP"]function file_notes(){

$act = $_GET['act'];
$do = $_GET['do'];

if((isset($act) && $act == "notes") && isset($do) && $do == "notes"){

$file = "notes.txt";
if(!unlink($file)){
echo "Can not delete $file";
}else{
$content = $_REQUEST['new_notes_content'];
if(!file_exists($file)){
$open = fopen($file, "a");
fwrite($open, $content);
fclose($open);
echo "<center><b>Note book</b><br>Notebook updated!</center><br>";
echo notes_form();
}elseif(file_exists($file)){
$open = fopen($file, "a");
fwrite($open, $content);
fclose($open);
echo "<center><b>Note book</b><br>Notebook updated!</center><br>";
echo notes_form();
}
}
}
}elseif(isset($act) && $act == "notes" && !isset($do)){

$file = "notes.txt";
if(!file_exists($file)){
$open = fopen($file, "a");
fwrite($open, "");
fclose($open);
}
$txt = file_get_contents($file);
echo "<center><b>Notebook</b></center><br>
<form action='?act=notes&do=notes' method='post'>
<table width='500' border='0' align='center'>
<tr>
<td><textarea cols='100' rows='15' name='new_notes_content'>$txt</textarea><br><input type='submit' value='Update'></form></td>
</tr>
</table>";

}
}[/HIGHLIGHT]

i really can't find what's wrong with my elseif thingy

[HIGHLIGHT="PHP"]}elseif(isset($act) && $act == "notes" && !isset($do)){[/HIGHLIGHT]

this line is this 384... :/ but i can't find any problems
maybe you can help me..

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
You have to many ending brackets "}"

In this line:

}elseif(isset($act) && $act == "notes" && !isset($do)){

Remove the leading }

elseif(isset($act) && $act == "notes" && !isset($do)){


#3
Guest_Jaan_*

Guest_Jaan_*
  • Guests
oh..
:D
hahaha.. sorry my bad
thanks mate :D

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
No problem!