Ejemplo n.º 1
0
<head>
<meta charset="UTF-8">
      <title>3_1challenge</title>
</head>
  ボタンを押してください
  <br><br>
  <form action="http://localhost/develop/challenge3/3_1challenge.php" method="POST">
    <input type="submit" name="btn" value="プロフィール">
  </form>

  <body>

    <?php 
function my_profile()
{
    return array(1 => 'TakaharuSakamoto<br>', 2 => '1988-11-24<br>', 3 => '前職:飲食業<br>');
}
if (!empty($_POST['btn'])) {
    for ($i = 1; $i <= 2; $i++) {
        $profile = my_profile();
        foreach ($profile as $value) {
            echo $value;
        }
    }
}
?>

  </body>

</html>
Ejemplo n.º 2
0
if (my_profile(true)) {
    echo "この処理は正しく実行できました。";
} else {
    echo "正しく実行できませんでした。";
}
function my_profile()
{
    echo "中村誠希</br>";
    echo "1991年9月14日</br>";
    echo "ヤッホー!!</br>";
    return true;
}
//一回目の表示
my_profile();
//2回目の表示
my_profile();
//課題2
//引数を指定
check_number(5);
function check_number($number)
{
    if ($number % 2 == 0) {
        echo "偶数です。";
    } else {
        echo "奇数です。";
    }
}
?>


    </body>
Ejemplo n.º 3
0
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>PHP基礎</title>
</head>
<boby>

<?php 
//課題4:課題1で定義した関数に追記する形として、戻り値 true(bool値) を返却するように
//修正し、関数の呼び出し側でtrueを受け取れたら「この処理は正しく実行できました」、
//そうでないなら「正しく実行できませんでした」と表示する
function my_profile()
{
    print "松本卓也<br>";
    print "1991年9月2日<br>";
    print "私の好きなラーメン屋は小岩駅近くにある「鼈(すっぽん)」です。ここの味噌ラーメンは絶品です!<br>";
    $ramen = true;
    return $ramen;
}
for ($i = 1; $i < 10; $i++) {
    my_profile();
}
$a = my_profile();
if ($a == true) {
    print "<br><br>この処理は正しく実行できました<br>";
} else {
    print "<br><br>正しく実行できませんでした<br>";
}
?>

</body>
</html>
Ejemplo n.º 4
0
<?php

function my_profile()
{
    echo "私の名前は加藤良介です<br>";
    echo "生年月日は平成1年1月22日です<br>";
    echo "趣味はバドミントンです<br>";
    $profile = true;
    return $profile;
}
$result = my_profile();
if ($result == true) {
    echo 'この処理は正しく実行できました';
} else {
    echo '正しく実行できませんでした';
}
Ejemplo n.º 5
0
<!DOCTYPE html>
<html lang="ja">
<meta charset="utf-8">
</html>
<?php 
//課題1,4
function my_profile()
{
    echo "中村誠希</br>";
    echo "1991年9月14日</br>";
    echo "ヤッホー!!</br>";
    return true;
}
//一回目の表示
my_profile();
//2回目の表示
my_profile();
//課題4
$bool = my_profile();
if ($bool == true) {
    echo "この処理は正しく実行できました。" . "<br>";
} else {
    echo "正しく実行できませんでした。" . "<br>";
}
Ejemplo n.º 6
0
<?php

function my_profile()
{
    echo "私の名前は若狭です<br/>";
    echo "誕生日は11/29<br/>";
    echo "蕎麦がすきです<br/>";
    $result = true;
    return $result;
}
for ($i = 0; $i < 10; $i++) {
    $v = my_profile();
    if ($v == true) {
        echo "この関数は正しく実行されました<br/>";
    }
}
//課題4
Ejemplo n.º 7
0
<?php

session_start();
include "../db/connect_db.php";
$dataPage = $_POST['page'];
switch ($dataPage) {
    case "my_profile":
        my_profile($mysqli);
        break;
    case "my_profile_update":
        $email = $_POST['email'];
        $FIO = $_POST['FIO'];
        $password = $_POST['password'];
        my_profile_update($mysqli, $email, $FIO, $password);
        break;
    case "port_allShow":
        port_allShow($mysqli);
        break;
    case "deletePort":
        deletePort($mysqli);
        break;
    case "updatePort":
        updatePort($mysqli);
        break;
    case "updatePortModal":
        updatePortModal($mysqli);
        break;
    case "addPort":
        addPort($mysqli);
        break;
    case "vesselType_allShow":