-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.php
More file actions
30 lines (25 loc) · 865 Bytes
/
form.php
File metadata and controls
30 lines (25 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
if ( !defined( 'VOCAL_CODE' ) ) {
die( 'nope' );
}
$source = isset( $_POST['source'] ) ? $_POST['source'] : '';
$language = isset( $_POST['lang'] ) ? $_POST['lang'] : 'text';
function option( $inner, $value, $selected = null ) {
$attrib = 'value="' . htmlspecialchars( $value ) . '"';
if ( $value === $selected ) {
$attrib .= ' selected';
}
return "\t\t<option $attrib>$inner</option>\n";
}
?>
<form name="source-form" id="source-form" action="index.php" method="post">
<textarea placeholder="put your source here" name="source" style="width:100%; height:10em;"><?php echo htmlspecialchars( $source ) ?></textarea>
<br/>
<select name="lang" class="btn">
<?php
echo option( 'JavaScript', 'javascript', $language );
echo option( 'PHP', 'php', $language );
?>
</select>
<button type="submit" class="btn">Highlight</button>
</form>