BrianM Posted June 12, 2008 Share Posted June 12, 2008 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 More sharing options...
DarkWater Posted June 12, 2008 Share Posted June 12, 2008 1) You missed a ; after line 84. 2) Don't put function in front of it, it thinks you're making a new function, not calling one. Link to comment https://forums.phpfreaks.com/topic/109819-parse-error-with-function/#findComment-563573 Share on other sites More sharing options...
bluejay002 Posted June 12, 2008 Share Posted June 12, 2008 with darkwaters suggestion, it should look like this: <?php if ($_GET['report'] == 'create') { report_create(); // not function report_create() } // line 85 if ($_GET['report'] == 'view') { report_view(); // not function report_view() } ?> Link to comment https://forums.phpfreaks.com/topic/109819-parse-error-with-function/#findComment-563576 Share on other sites More sharing options...
BrianM Posted June 12, 2008 Author Share Posted June 12, 2008 <?php if ($_GET['report'] == 'create') { report_create(); } // line 85 if ($_GET['report'] == 'view') { report_view(); } ?> Perhaps something along those lines? Link to comment https://forums.phpfreaks.com/topic/109819-parse-error-with-function/#findComment-563577 Share on other sites More sharing options...
bluejay002 Posted June 12, 2008 Share Posted June 12, 2008 what was the error this time? as far as i see the code, nothing else is wrong with it. I think that the error is caused somewhere else outside these lines (since sometimes the parser points the error at a different line). Link to comment https://forums.phpfreaks.com/topic/109819-parse-error-with-function/#findComment-563583 Share on other sites More sharing options...
DarkWater Posted June 12, 2008 Share Posted June 12, 2008 Yeah, does that even error you? Link to comment https://forums.phpfreaks.com/topic/109819-parse-error-with-function/#findComment-563584 Share on other sites More sharing options...
BrianM Posted June 12, 2008 Author Share Posted June 12, 2008 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>"); } ?> Link to comment https://forums.phpfreaks.com/topic/109819-parse-error-with-function/#findComment-563603 Share on other sites More sharing options...
widox Posted June 12, 2008 Share Posted June 12, 2008 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>"); } ?> Link to comment https://forums.phpfreaks.com/topic/109819-parse-error-with-function/#findComment-563606 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.