Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Outputing PHP tags in a Textarea
Old 08-10-2008, 06:05 PM Outputing PHP tags in a Textarea
Extreme Talker

Posts: 199
Trades: 0
I need to show PHP and HTML code inside of a textarea for people to copy out into their own site. I can get code to work correct without PHP code in it like
Code:
htmlspecialchars("<iframe src =\"http://www.sitename.com/app/score.php?quiz_id=".$_SESSION['action']['quiz_id']."&uid=0\" width=\"480\" height=\"925\" scrolling=\"no\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>".$show_commander, ENT_QUOTES);
But when adding PHP code into it its all FUBAR'd and throws a "Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /hsphere/local/home/santccom/sitename/app/step8.php on line 123 " error. This is my f'd code

Code:
<?= htmlspecialchars("<? if($_GET['proxy']){ $param = 'field_name='.$_GET[field_name].'&proxy=1'; }else{ $param = 'quiz_id='.$_SESSION[action][quiz_id].'&uid=0'; } ?>".$show_commander, ENT_QUOTES); echo'<iframe src=\"http://www.sitename.com/app/score.php?$param\" width=\"480\" height=\"925\" scrolling=\"no\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>'; ?>
What i need is for something to look exactly similar to the following on screen inside of my textarea.
Code:
<? if($_GET['proxy']){ $param = "field_name=".$_GET['field_name']."&proxy=1"; }else{ $param = "quiz_id=119&uid=0"; }

echo"<iframe src=\"http://www.sitename.com/app/score.php?$param\" width=\"480\" height=\"925\" scrolling=\"no\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>"; ?>
Where am i going wrong? Thanks for the help.
empiresolutions is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-10-2008, 06:46 PM Re: Outputing PHP tags in a Textarea
Extreme Talker

Posts: 199
Trades: 0
ok i got the result i wanted, but i thinks is very dirty. I'm going with this way for now, but im still open for suggestions on the "correct" way to do it.

Code:
<?= htmlspecialchars("<?php", ENT_QUOTES); ?> if($_GET['proxy']){ $param = 'field_name='.$_GET[field_name].'&question_num='.$_GET[question_num].'&quiz_id='.$_GET[quiz_id].'&score_id='.$_GET[score_id].'&field_value='.$_GET[field_value].'&proxy=1'; }else{ $param = '<?= htmlspecialchars('quiz_id='.$_SESSION[action][quiz_id].'&uid=0&score_id='.$_SESSION[quiz][score_id].'&offsite=1', ENT_QUOTES); ?>'; } echo"<iframe src=\"http://www.commander.com/app/score.php?$param\" width=\"480\" height=\"925\" scrolling=\"no\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>"; echo"<?= htmlspecialchars($show_commander, ENT_QUOTES); ?>"; <?= htmlspecialchars("?>", ENT_QUOTES); ?>

Last edited by empiresolutions; 08-10-2008 at 06:53 PM..
empiresolutions is offline
Reply With Quote
View Public Profile
 
Old 08-10-2008, 07:32 PM Re: Outputing PHP tags in a Textarea
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
You might want to take a look at two functions builtin PHP:

highlight_file() and highlight_string()
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Outputing PHP tags in a Textarea
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19466 seconds with 12 queries