0
How to get PHP input in Code Playground?
I already know to do it using HTML forms. But in code playground I can't add HTML. Is there an option to link a web code to php code or should I echo a form?
3 Answers
+ 5
some like this:
<?php
echo '<html><head>...</head><body>';
varname='somevar';
if(!$_GET[varname]) {
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'" method="GET">enter your value:<input type="text" name="'.varname.'"><input type="submit"></form>';
} else {
echo '<h1>You enter this value :'.$_GET[varname].'</h1>';
}
echo "</body></html>';
?>
+ 2
may this helps you
https://www.sololearn.com/Discuss/1136963/?ref=app
+ 2
as I see, it not work, in playground $_SERVER['SCRIPT_NAME'] is equel to 'Playground'
take a source of your phpcode you can : echo file_get_contents('source.php');
but you not callback your code with entered data.
you can make a iframe, that put your data on someone else server,f.e. in http://your_site.com/secret_area/input_for_sololearn.txt,
and take it on the next run of your php script by getting it from http://your_site.com/secret_area/input_for_sololearn.txt
OR GET YOUR EXPERIANCE ON YOUR HOST WHITH PHP. F.E. http://www.000webhost.com



