The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
What is the error <<<END_OF_TEXT..END_OF_TEXT;
Discuss What is the error <<<END_OF_TEXT..END_OF_TEXT; in the PHP Development forum on Dev Shed. What is the error <<<END_OF_TEXT..END_OF_TEXT; PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 23rd, 2012, 06:35 PM
|
|
Registered User
|
|
Join Date: Feb 2003
Posts: 322
Time spent in forums: 2 Days 7 h 50 m 54 sec
Reputation Power: 0
|
|
|
What is the error <<<END_OF_TEXT..END_OF_TEXT;
Why can't i get text to display in the select tag?
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/shawnhbk/public_html/az/notes/addcode.php on line 22
PHP Code:
if ($_POST['title'] == "")
{//haven't seen the form, so show it
$display_block = <<<END_OF_TEXT
<form method="post" action="$_SERVER[PHP_SELF]">
<p>
<select name="language">
$query="SELECT DISTINCT language FROM codes";
if ($result = $mysqli->query($query)) {
/* fetch object array */
while ($row = $result->fetch_assoc()) {
$language=$row['language'];
echo("<option value="$language">$language</option>");
} $result->close();
</select>
<p><label for="title">title</label><br/>
<input type="text" name="title">
<p><textarea class="ckeditor" rows="4" cols="50" name="code" ></textarea>
<button type="submit" name="submit" value="send">Add Entry</button>
</form>
END_OF_TEXT;
}
|

December 23rd, 2012, 06:56 PM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
|
Hi,
this code makes no sense whatsoever. The heredoc covers almost your whole code, while you have PHP and HTML randomly mixed. What is this supposed to do??
|

December 23rd, 2012, 07:02 PM
|
|
Registered User
|
|
Join Date: Feb 2003
Posts: 322
Time spent in forums: 2 Days 7 h 50 m 54 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by Jacques1 Hi,
this code makes no sense whatsoever. The heredoc covers almost your whole code, while you have PHP and HTML randomly mixed. What is this supposed to do?? |
I thought you can use php inside heredoc that was the whole purpose of it wasnt it?
|

December 23rd, 2012, 07:07 PM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
|
Um, no? Where did you read that? And how would that even work?
A heredoc works exactly like a double quoted string -- the only difference is that you don't have to escape double quotes. So you can insert variables and escape sequences (newlines etc.), but that's it. Anything else is interpreted as literal characters.
|

December 23rd, 2012, 07:08 PM
|
|
Registered User
|
|
Join Date: Feb 2003
Posts: 322
Time spent in forums: 2 Days 7 h 50 m 54 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by Jacques1 Um, no? Where did you read that? And how would that even work?
A heredoc works exactly like a double quoted string -- the only difference is that you don't have to escape double quotes. So you can insert variables and escape sequences (newlines etc.), but that's it. Anything else is interpreted as literal characters. |
got it thanks
|

December 23rd, 2012, 07:15 PM
|
|
Registered User
|
|
Join Date: Feb 2003
Posts: 322
Time spent in forums: 2 Days 7 h 50 m 54 sec
Reputation Power: 0
|
|
|
so how would i put all this php code inside a variable can you point me in the right direction?
|

December 23rd, 2012, 07:25 PM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
I don't even understand what you're trying to do. What do you mean by "putting PHP code into a variable"?
Isn't this simply about outputting HTML strings?
PHP Code:
if ($_POST['title'] == "")
{ //haven't seen the form, so show it
echo "
<form method='post' action='$_SERVER[PHP_SELF]'>
<p>
<select name='language'>
";
...
}
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|