0

自分のサイトに html を自分のサイトにエコーし、入力した SQL 値を取得させたい

通常のphp echoでは、次のようになります

echo "</br><input type=\"checkbox\" name=\"inputFs\" value=\"1\" " . $person['Fs'] . "/>Syns på förstasidan"

しかし、それをissetに入れるときはどうすればよいですか?

echo isset($person['Fs'] == "")) ? "</br><input type=\"checkbox\" name=\"inputFs\" value=\"1\" " . $person['Fs'] . "/>Syns på förstasidan" : "";
4

1 に答える 1

1

Can't figure it out why you are using $person["Fs"] inside input tag May be this should help

echo (isset($person['Fs']) ? '</br><input type="checkbox" name="inputFs" value="1"/>Syns på förstasidan' : '');

OR

If you are using $person["Fs"] for value then try this

echo (isset($person['Fs']) ? '</br><input type="checkbox" name="inputFs" value="' . $person["Fs"] .'"/>Syns på förstasidan' : '');

If your checking for a variable if it is blank or contain some particular value. Then you don't have to use isset it works without isset Consider your checking if $person['Fs'] == "checked" then use

echo ($person['Fs'] == "checked" ? '</br><input type="checkbox" name="inputFs" value="' . $person["Fs"] .'"/>Syns på förstasidan' : '');
于 2013-06-25T20:11:47.230 に答える