jamesxg1 Posted March 5, 2010 Share Posted March 5, 2010 Hiya peeps! Heres the code. foreach($_POST as $key => $val): echo '\$' . $key . ' = mysql_real_escape_string(trim(addslashes(\$_POST[' . $key . '])));<br />'; foreach; Heres whats returned. Parse error: syntax error, unexpected ';', expecting '(' in *** on line 12 I dont understand, I have escaped all vars. Many thanks James. Link to comment https://forums.phpfreaks.com/topic/194204-echo-syntax-error/ Share on other sites More sharing options...
cags Posted March 5, 2010 Share Posted March 5, 2010 It's because you are misusing the alternative foreach syntax. Try... foreach($_POST as $key => $val): echo '\$' . $key . ' = mysql_real_escape_string(trim(addslashes(\$_POST[' . $key . '])));<br />'; endforeach; Link to comment https://forums.phpfreaks.com/topic/194204-echo-syntax-error/#findComment-1021866 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.