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 回答