Show DevBest [PHP]Simple HTML TryIt R1[Mac]

Status
Not open for further replies.

Mac

New Member
Feb 9, 2011
111
2
PHP:
<?php 
$code = $_POST['code'];
$submited = $_POST['go']; 
if($submited):
    if($code):
        print "<fieldset>".$code."</fieldset><br /><br /><br />";
    else:
        echo "<p>Empty code!</p>";
    endif;
endif;
echo <<< END
<form method='post'>
<b>Test your html code.</b><br />
<textarea name='code' rows='5' cols='50'>{$code}</textarea><br />
<input type='submit' name='go'>
</form>
END;
?>

Credits to me !
 

Mac

New Member
Feb 9, 2011
111
2
No , i should not ! if you put object it will not show as html ! it will show like that : <h1>object</h1>
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389


PHP:
<?php 
$codetoshow = stripslashes( nl2br( htmlspecialchars( $_POST['code'] ) ) );
$codefortextarea = stripslashes( $_POST['code'] );
$submited = $_POST['go']; 
if($submited):
    if($codetoshow):
        print "<fieldset>".$codetoshow."</fieldset><br /><br /><br />";
    else:
        echo "<p>Empty code!</p>";
    endif;
endif;
echo <<< END
<form method='post'>
<b>Test your html code.</b><br />
<textarea name='code' rows='5' cols='50'>{$codefortextarea}</textarea><br />
<input type='submit' name='go'>
</form>
END;
?>
 

Bazinga

Posting Freak
Aug 3, 2010
819
54
Fail
092ns4

I thought it was supposed to test HTML code?
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
Fail
092ns4

I thought it was supposed to test HTML code?

I'm showing what can be done with it you noob.

Anyway, even if you try it with no htmlspecialchars or whatever I put in, it won't run anyway.
 

Mac

New Member
Feb 9, 2011
111
2
Yes it will run ! I tested it!

@Bazinga {
Use first post's code and it will work!
}

proof :
You must be registered for see images attach
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
Yes it will run ! I tested it!

@Bazinga {
Use first post's code and it will work!
}

proof :
You must be registered for see images attach

I mean stuff like
Code:
<script type="text/javascript">alert('hi');</script>
don't work for me.
 
Status
Not open for further replies.

Users who are viewing this thread

Top