no message

This commit is contained in:
a-kizaki
2026-10-14 09:52:49 +09:00
commit 7e5bc1bf12
33 changed files with 10318 additions and 0 deletions

125
StringCheck.php Normal file
View File

@@ -0,0 +1,125 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel=stylesheet type="text/css" href="css/bootstrap.min.css">
<link rel=stylesheet type="text/css" href="css/bootstrap-theme.min.css">
<link rel=stylesheet type="text/css" href="css/styleSheet.css">
<link
href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css"
rel="stylesheet">
<link href="css/pnotify.custom.min.css" media="all" rel="stylesheet"
type="text/css" />
<title>StringCheck</title>
<style>
/* テキストエリアがパネルをはみ出さないようにする */
.panel-body .form-control {
max-width: 100%;
box-sizing: border-box;
}
</style>
</head>
<body>
<?php
// ここにPHPのコードを記述してください
// POSTリクエストがあった場合に処理を実行
$message = "";
$errorMessage = "";
$successMessage = "";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$inputResult = inputCheck($_POST['topic']);
$errorMessage = $inputResult["???"];
$message = $inputResult["???"];
}
function inputCheck($checkValue)
{
// 以下の変数はローカルスコープ。30行目の$errorMessageとは別物だよ。あれはグローバルスコープ。
$errorMessage = "";
$inputValue = null;
if (!empty($checkValue)) {
// 以下に文字列チェックの処理を記述してください
}
return array(
"errorMessage" => $errorMessage,
"message" => $inputValue
);
}
?>
<!-- main -->
<div class="container">
<div class="row">
<!-- 投稿 -->
<div class="col-xs-offset-3 col-xs-6">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">投稿フォーム</h3>
</div>
<div class="panel-body">
<form action="StringCheck.php" name="topicForm" id="topicForm"
class="form-horizontal" method="POST">
<div class="form-group">
<label class="col-xs-2 control-label"><img class="img"
src="image/itc.png" width="40" height="40"></label>
<div class="col-xs-10">
<textarea name="topic" id="topic" rows="2"
placeholder="いまなにしてる?" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-2 col-xs-10">
<button type="submit" class="btn btn-info">投稿</button>
</div>
</div>
</form>
<!-- 以下のようにphpとhtmlを混ぜて書くことができます -->
<?php if (!empty($errorMessage)): ?>
<div class="alert alert-danger"><?php echo $errorMessage; ?></div>
<?php endif; ?>
<?php if (!empty($successMessage)): ?>
<div class="alert alert-success"><?php echo $successMessage; ?></div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<!-- 投稿メッセージの表示 -->
<div class="row">
<div class="col-xs-offset-3 col-xs-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">投稿メッセージ</h3>
</div>
<div class="panel-body">
<?php
if (!empty($message)) {
// 投稿メッセージをここで表示
} else {
echo $err_msg;
}
?>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery-1.11.2.min.js"></script>
<script src="js/jquery.uploadThumbs.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/pnotify.custom.min.js"></script>
<script type="text/javascript">
// 各ダイアログサブミット
function executeTopic() {
$("#topicForm").submit();
}
</script>
</body>
</html>