Created
July 27, 2015 11:17
-
-
Save masakielastic/88c1be23d5e8835fbe29 to your computer and use it in GitHub Desktop.
textarea の練習。投稿内容をテキストファイルとして保存。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_POST['message'])) { | |
file_put_contents('db.txt', $_POST['message']); | |
$text = $_POST['message']; | |
} else { | |
$text = file_get_contents('db.txt'); | |
} | |
$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); | |
?> | |
<form action="/test/index.php" method="POST"> | |
<p> | |
<input type="submit" value="保存する" /> | |
</p> | |
<p> | |
<input type="textarea" style="padding: 5px; margin : 10px; text-align:left; width: 300px; height: 150px;" name="message" value="<?= $text ?>" /> | |
</p> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment