Jump to content

parse error with function()


BrianM

Recommended Posts

I get this error

 

Parse error: parse error, expecting `'{'' in C:\Program Files\Apache Group\Apache2\htdocs\mps\view\index.php on line 85

 

with this code

 

<?php
if ($_GET['report'] == 'create') {
function report_create()
} // line 85
if ($_GET['report'] == 'view') {
	function report_view()
	}
?>

 

What did I do wrong? :\

Link to comment
https://forums.phpfreaks.com/topic/109819-parse-error-with-function/
Share on other sites

I get an error on line 84 - Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\Program Files\Apache Group\Apache2\htdocs\mps\view\index.php on line 84

 

What does this mean, I'm pretty sure it's got something to do with echo $_SERVER['PHP_SELF'];

 

<?php
function report_create() {
	echo("<form action=\"echo $_SERVER['PHP_SELF'];\" method=\"post\">"); // line 84
	echo("<b><font size=\"2px\" face=\"Verdana\">Create report: </font></b><input type=\"text\" /> <input type=\"submit\" value=\"Create\" /><br /><br />");
	echo("</form>");
	}
?>

I get an error on line 84

...

What does this mean, I'm pretty sure it's got something to do with echo $_SERVER['PHP_SELF'];

 

DING DING!!

 

Try this:

<?php
function report_create() {
	echo("<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">"); // line 84
	echo("<b><font size=\"2px\" face=\"Verdana\">Create report: </font></b><input type=\"text\" /> <input type=\"submit\" value=\"Create\" /><br /><br />");
	echo("</form>");
	}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.