前提・実現したいこと
PHPポートフォリオ作成
ここに質問の内容を詳しく書いてください。
PHPを使用して今ある食材からレシピを提供するというシステムを作成したいと考えております。
if文を使用してレシピを出すようにしたいのですが、HTMLのどの部分に書き込めばいいのか分かりません。
下記コードをご確認いただけたらと思います。
<?php class Recipe{ public $potaufeu; public $friedrice; public $potatosalad; public function __construct($name,$image,$url){ $this->name=$name; $this->image=$image; $this->url=$url; } } $potaufeu=new Recipe('ポトフ','https://video.kurashiru.com/production/videos/5aee929a-6f58-4bda-a10c-68e4d4e381aa/compressed_thumbnail_square_large.jpg?1583891929','https://www.kurashiru.com/recipes/5aee929a-6f58-4bda-a10c-68e4d4e381aa'); $friedrice=new Recipe('チャーハン','https://jp.rakuten-static.com/recipe-space/d/strg/ctrl/3/d91df891dd7723749e0e8ef520af3960d899ef15.12.2.3.2.jpg','https://recipe.rakuten.co.jp/recipe/1240018924/','https://kumiko-jp.com/archives/97022.html'); $potatosalad=new Recipe('ポテトサラダ','https://kumiko-jp.com/wp-content/uploads/jsonld/2016/09/3P9A4155-2_edited-1-1_16x9.jpg',''); $potato ='じゃがいも'; $wiener ='ウィンナー'; $onion ='玉ねぎ'; $egg ='卵'; $ingredients = array($potato,$wiener,$onion,$egg); ?> <!doctype html> <html lang="ja" > <head> <title>Men's パパっとクッキング</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> <link href="https://fonts.googleapis.com/css?family=Noto+Sans+JP&display=swap" rel="stylesheet"> <link href="signin.css" rel="stylesheet"> <link href="../example.css" rel="stylesheet"> </head> <body class="text-center" > <a id="skippy" class="sr-only sr-only-focusable" href="#content"> <div class="container"> <span class="skiplink-text">Skip to main content</span> </div> </a>php
1コード
<!-- <h1 class="h3 mb-3 font-weight-normal">Please sign in</h1> --> <h1 class="h3 mb-3 font-weight-normal">Men's パパっとクッキング</h1> <!-- <label for="inputEmail" class="sr-only">Email address</label> --> <label for="ingredients" class="ingredients1"></label> <!-- <input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus> --> <input type="text" name="ingredients1" placeholder="食材1" required autofocus> <label for="ingredients" class="ingredients2"></label> <!-- <input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus> --> <input type="text" name="ingredients2" placeholder="食材2" required autofocus> <label for="ingredients" class="ingredients3"></label> <!-- <input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus> --> <input type="text" name="ingredients3" placeholder="食材3" required autofocus> <input type="submit" value="送信"> </form><form class="ingresients-select">
<script> window.jQuery || document.write('<script src="/docs/4.5/assets/js/vendor/jquery-slim.min.js"></script>')<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
</script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.bundle.min.js"></script><script src="/docs/4.5/assets/js/vendor/anchor.min.js"></script>
<script src="/docs/4.5/assets/js/vendor/clipboard.min.js"></script> <script src="/docs/4.5/assets/js/vendor/bs-custom-file-input.min.js"></script> <script src="/docs/4.5/assets/js/src/application.js"></script> <script src="/docs/4.5/assets/js/src/search.js"></script> <script src="/docs/4.5/assets/js/src/ie-emulation-modes-warning.js"></script> </body> </html>回答1件
あなたの回答
tips
プレビュー