runestation Posted January 29, 2010 Share Posted January 29, 2010 Okay, so I have a textarea, and I want the php code that's within it to not show as the initial value, but if i remove it, the code doesn't work... How can I hide that code but still make it work? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/190310-php-code-src/ Share on other sites More sharing options...
schilly Posted January 29, 2010 Share Posted January 29, 2010 posting the code would help. Quote Link to comment https://forums.phpfreaks.com/topic/190310-php-code-src/#findComment-1004012 Share on other sites More sharing options...
runestation Posted January 30, 2010 Author Share Posted January 30, 2010 <label><textarea name="currentxp"> <?php $name = $_POST['username']; $filecontents = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$name"); $stats = explode(',' , $filecontents); $exp = explode("\n", $stats[24]); echo $exp[0]; //209351778 //echo print_r($stats);//dont need this ?> </textarea> </label> Quote Link to comment https://forums.phpfreaks.com/topic/190310-php-code-src/#findComment-1004017 Share on other sites More sharing options...
jamiet757 Posted January 30, 2010 Share Posted January 30, 2010 The server is parsing the php code as php, you need to figure out a way to put it in quotes or something so the server doesn't see it as php code, but rather text in a text area. Quote Link to comment https://forums.phpfreaks.com/topic/190310-php-code-src/#findComment-1004018 Share on other sites More sharing options...
runestation Posted January 30, 2010 Author Share Posted January 30, 2010 but if it's not php code, and its only seen as text, won't the code not work? Quote Link to comment https://forums.phpfreaks.com/topic/190310-php-code-src/#findComment-1004022 Share on other sites More sharing options...
teamatomic Posted January 30, 2010 Share Posted January 30, 2010 You are showing the code block within php start/end tags so the code above and below must be just pure html. Just remove the start/end tags. If you want them to show also then replace < with < and > with >. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/190310-php-code-src/#findComment-1004025 Share on other sites More sharing options...
jamiet757 Posted January 30, 2010 Share Posted January 30, 2010 but if it's not php code, and its only seen as text, won't the code not work? I don't really understand what you are trying to accomplish. Do you want a text area to appear with the code in it, so others can see the source, or are you trying to get the text area to have the result of the code in it? Quote Link to comment https://forums.phpfreaks.com/topic/190310-php-code-src/#findComment-1004026 Share on other sites More sharing options...
runestation Posted January 30, 2010 Author Share Posted January 30, 2010 No, I don't want them to see the code. I want them to see nothing at first, and then once they enter their name, it does the function i made it do (which does work). Quote Link to comment https://forums.phpfreaks.com/topic/190310-php-code-src/#findComment-1004027 Share on other sites More sharing options...
teamatomic Posted January 30, 2010 Share Posted January 30, 2010 Wont happen the way you want. What you need to do is use a text box and use that form to call another with the function return inserted into the textarea or use javascript. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/190310-php-code-src/#findComment-1004028 Share on other sites More sharing options...
ignace Posted January 30, 2010 Share Posted January 30, 2010 Why did you not use my provided code? http://www.phpfreaks.com/forums/index.php/topic,285779.msg1355375.html#msg1355375 It is far better then what you have now and more easily to work with. Quote Link to comment https://forums.phpfreaks.com/topic/190310-php-code-src/#findComment-1004155 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.