-1
我正在嘗試打印一個項目列表,並在其旁邊的數量的計算。到目前爲止,只有數量被打印在圖像旁邊。我需要這個值(即蘋果)出現。該值確實出現,直到我添加「數量」。任何幫助將不勝感激。打印文字和PHP變量
echo "<br/><br/><br/> You are leaving on ". $_POST["departuredate"]."</p>";
echo "You are returning on ". $_POST["returndate"]."</p>";
$return= strtotime($_POST["returndate"]);
$depart = strtotime($_POST["departuredate"]);
$datediff = $return - $depart;
echo "You are going for <b> ";
$quantity=floor($datediff/(60*60*24));
echo $quantity;
echo " days";
$Yoghurt= 'Yoghurt' + $quantity;
$Apple = 'Apple' + $quantity;
$Banana = 'Banana' + $quantity;
....
$FoodList=array_unique($FoodList);
$img_path = 'empty_checkbox.gif';
if(!empty($FoodList))
{
foreach ($FoodList as $key => $value)
{
echo "<li>" . "<img src='$img_path' />" . " ". $value ."</li>";
}
echo "</ul>";
}
從哪裏'$ FoodList'來? – DontVoteMeDown
'$ Yoghurt ='Yoghurt'+ $ quantity;''+'來自JavaScript。它必須是'.' – iCode