Re: parse error, unexpected T_ENCAPSED_AND_WHITESPACE

From: Date: Mon, 14 Mar 2005 23:46:12 +0000
Subject: Re: parse error, unexpected T_ENCAPSED_AND_WHITESPACE
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-210777@lists.php.net to get a copy of this message
Hello, I've made the source available at: http://www.weldingconsultants.com/wcapp/admin.phps Chris W. Parker wrote:
print '<td><input type=\'checkbox\' name=\'status[' . $row["profileID"] . ']' . "' value='true'/></td>\n";
Very likely the problem is not on line 82, but rather before it. Line 82 is just where the PHP parser finally gets screwed up.
Yeah, that is what I was thinking too. But I can't find what the problem is earlier in the file. *sigh*
$profID = $row["profileID"]; print '<td><input type=\'checkbox\' name=\'status[' . $profID . ']' . "' value='true'/></td>\n"; When I had done that, the parser started choking at the top line.
I suggest the following: (The HTML should all be on one line.) echo "<td><input type=\"checkbox\" name=\"status[{$row['profileID']}]\" value=\"true\" /></td>";
I'll do that, simply because it is a little clearer to read, but I don't think the problem actually has to do with my string delimeters and escaping. For one thing, as I mentioned, the problem seems to be with $row["profileID"], based upon the fact that I moved that out onto a line basically by itself, and the parser error 'moved' to that line.
Please don't send attachments to a public mailing list. Besides, I don't think they go through anyway.
Ok, I'll just post links in the future. I just thought it would be more convenient to attach it, but I can link, that's no problem. Also, from your followup:
Ohh .. and if i read it more fully the first time I would have seen that you've got some funky in/out quoting problems and that you're not escaping the quotes wrapping 'true'.
If you go back and look again, I don't need the single-quotes wrapping 'true' to be escaped, because that chunk of the string is wrapped in double-quotes. Yeah, I know, it's confusing lol. One of the problems of using PHP to print html, unfortunately. Well, part of the reason I have the string construction set up so strangely, is that I was testing out to see if certain things were causing problems. Originally I had it setup more like how you suggested. I only changed it to test some theories out about what might be causing the parser error. Jeff Schmidt

« previous php.general (#210777) next »