PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 23rd, 2012, 06:35 PM
shawnhbk shawnhbk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 322 shawnhbk Negative: is most likely a SPAMMER and a traitor to the cause. 
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;


Reply With Quote
  #2  
Old December 23rd, 2012, 06:56 PM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,835 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 4 h 14 m 14 sec
Reputation Power: 811
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??

Reply With Quote
  #3  
Old December 23rd, 2012, 07:02 PM
shawnhbk shawnhbk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 322 shawnhbk Negative: is most likely a SPAMMER and a traitor to the cause. 
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?

Reply With Quote
  #4  
Old December 23rd, 2012, 07:07 PM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,835 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 4 h 14 m 14 sec
Reputation Power: 811
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.

Reply With Quote
  #5  
Old December 23rd, 2012, 07:08 PM
shawnhbk shawnhbk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 322 shawnhbk Negative: is most likely a SPAMMER and a traitor to the cause. 
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

Reply With Quote
  #6  
Old December 23rd, 2012, 07:15 PM
shawnhbk shawnhbk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 322 shawnhbk Negative: is most likely a SPAMMER and a traitor to the cause. 
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?

Reply With Quote
  #7  
Old December 23rd, 2012, 07:25 PM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,835 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 4 h 14 m 14 sec
Reputation Power: 811
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'>
    "
;
    ...


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > What is the error <<<END_OF_TEXT..END_OF_TEXT;

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap