isset関数は引数に複数の値を渡すことができるので使いたいのです。下記のコードを参考に
php
1if (isset($_GET["a"], $_GET["b"], $_GET["c"])) { 2 // 処理 3}
僕のコードに挿入しましたが反応しません。
僕のコードにはisset文が使えないのですか?
ちなみにこちらのコードもチャレンジしてみましたが、できませんでした。
PHP
1if (isset($_GET["a"]) && isset($_GET["b"]) && 2isset($_GET["c"])) { 3 // 処理 4}
※下記が僕のコードです。
PHP
1<?php 2if (isset($_GET['keyword'], $_GET['budget'])) { 3$key='私のキー'; 4$count='50'; 5$large_area='◯◯'; 6$start =1+($page-1)*10; 7$keyword=$_GET ["keyword"]; 8$budget=$_GET ["budget"]; 9$format='xml'; 10$url='http://webservice.recruit.co.jp/hotpepper/gourmet/v1/?key='.$key.'&count='.$count.'&large_area='.$large_area.'&start='.$start.'&keyword='.$keyword.'&budget='.$budget.'&format='.$format; 11$xml=simplexml_load_file($url); 12・・・ 13・・・ 14・・・ 15} 16
html
1<html> 2<head> 3<title>API_SAMPLE</title> 4</head> 5<body> 6<form action="" method="GET"> 7<input type="text" name="keyword"> 8<input type="submit"> 9</form> 10</body> 11</html> 12<html> 13<head> 14<title>API_SAMPLE</title> 15</head> 16<body> 17 <form method="GET"> 18 <select name="budget"> 19 <option value="B001">〜2000円</option> 20 <option value="B002">2001円〜3000円</option> 21 <option value="B003">3001円〜4000円</option> 22 23 </select> <input type="submit" name="search" value="検索" onFocus="this.select()"> 24 </form> 25</body> 26</html>
回答5件
あなたの回答
tips
プレビュー