jamesxg1 Posted February 28, 2010 Share Posted February 28, 2010 Hiya, I have this code. foreach($_POST as $key => $val): echo "<code>isset($_POST['</code>" . $key . "<code>']) && !empty($_POST['</code>" . $key . "<code>']) &&</code>"; endforeach; And I get these errors. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING Many thanks James. Link to comment https://forums.phpfreaks.com/topic/193604-weird-errors/ Share on other sites More sharing options...
jl5501 Posted February 28, 2010 Share Posted February 28, 2010 you cannot use isset in that way you will have to do your isset checks on the actual variables and then construct your echo Link to comment https://forums.phpfreaks.com/topic/193604-weird-errors/#findComment-1019151 Share on other sites More sharing options...
jamesxg1 Posted February 28, 2010 Author Share Posted February 28, 2010 Hiya mate, Cheers for the reply. I got it working, I forgot to escape the $_POST varible. Here's the working code. foreach($_POST as $key => $val): echo "isset(\$_POST['" . $key . "']) && !empty(\$_POST['" . $key . "']) && "; endforeach; Many thanks James. Link to comment https://forums.phpfreaks.com/topic/193604-weird-errors/#findComment-1019152 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.