newbtophp Posted September 14, 2009 Share Posted September 14, 2009 Im haivng some trouble when i place. echo "\x64\x69\"; and open it in a browser it echos text. but when i put that some code in a field and submit it just echos whats been submitted. <?php $code = stripslashes($_POST['code']); $submit = $_POST['submit']; if($code == "") echo ""; else { echo "$code"; } ?> Link to comment https://forums.phpfreaks.com/topic/174227-echo-help/ Share on other sites More sharing options...
wshell Posted September 14, 2009 Share Posted September 14, 2009 Not entirely sure what you want to accomplish here but I would change your if condition to read cleaner by doing this. if (!$code == "") { echo $code; } The ! means 'NOT'... so it will only run the code block if $code is NOT "". Please provide more info on what you want to accomplish and I will try to help. Link to comment https://forums.phpfreaks.com/topic/174227-echo-help/#findComment-918484 Share on other sites More sharing options...
RussellReal Posted September 14, 2009 Share Posted September 14, 2009 are you trying to make the code you submit to be treated as php code not as plain text? Link to comment https://forums.phpfreaks.com/topic/174227-echo-help/#findComment-918485 Share on other sites More sharing options...
mikesta707 Posted September 14, 2009 Share Posted September 14, 2009 if you want to parse what has been submit as php then use eval $code = stripslashes($_POST['code']); $submit = $_POST['submit']; if($code == "") echo ""; else eval($code)"; Link to comment https://forums.phpfreaks.com/topic/174227-echo-help/#findComment-918488 Share on other sites More sharing options...
mikesta707 Posted September 14, 2009 Share Posted September 14, 2009 if you want to parse what has been submit as php then use eval $code = stripslashes($_POST['code']); $submit = $_POST['submit']; if($code == "") echo ""; else eval($code); Link to comment https://forums.phpfreaks.com/topic/174227-echo-help/#findComment-918503 Share on other sites More sharing options...
newbtophp Posted September 14, 2009 Author Share Posted September 14, 2009 Thanks for all your replies, not still no luck. Let me further explain, if you copy this code, save it and open it: <?php echo "\x64\x69\x73\x70\x6C\x61\x79"; ?> You'll get: display I've created a form which uses $_POST to submit \x64\x69\x73\x70\x6C\x61\x79 (code) and echo it which is supposed to give: display But is just echoing whats been inserted. Link to comment https://forums.phpfreaks.com/topic/174227-echo-help/#findComment-918504 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.