1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHP おみくじメモ

Last updated at Posted at 2019-05-07

rand()を知った時におみくじ作れるんじゃね?と思って作ってみた。(当たり前ですが、すでにあるものは無視して自分で考えて作ることを意識してます。)
ただ、それだけ。

#入力画面

index.php

    1から9までの数字を入れてGOボタンを押してね!

    <form method="post" action="result.php">
      <input type="text" name="fig">
      <input type="submit" value="GO">
    </form>

#結果を表示する

result.php



    $fig = $_POST['fig']; 
    $result = rand(1,9); 

    if ($fig == $result)
    {
      echo "当たりだよ。おめでとう!";
    } 
    else 
    {
      echo "外れだよ。ごめんね!";
    }

    echo '<br />';

一応動作はしたので、メモ程度に載せておきます。

#余談
実務で学ばないとどのようなイレギュラーがあるかわからないし、対処法もわからないのでこんなイレギュラーがあるよって人いたらコメントください。
それについて勉強しますので。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?