PHP空间自动放入

if ($result->num_rows > 0) {

while($row = $result->fetch_assoc()) {
    $name = $row['name'];
    $contents = $row['contents'];
    array_push($allnotes,"<b>",$name,":","</b>",$contents,"<br>   <form action='notes/delete-note.php' method='post'> <input type='hidden' name='removenote' value='",$name,"'> <button type='submit'        class='notedelete'>Delete ",$name,"</button> </form>");
 }
} else {
array_push($allnotes,"No avaliable notes!");
}

The problem i have is that the above code (here -> value='",$name,"'>) is adding spaces which in turn breaks it as my other code cant read it properly any idea on how to stop these spaces. Thanks

The way you are doing, is the same as:

$allnotes[] = "<b>";
$allnotes[] = $name;
$allnotes[] = ":"; 
$allnotes[] = "</b>";
$allnotes[] = $contents; 
$allnotes[] = "<br>   <form action='notes/delete-note.php' method='post'> <input type='hidden' name='removenote' value='"; 
$allnotes[] = $name; 
$allnotes[] = "'> <button type='submit'        class='notedelete'>Delete "; 
$allnotes[] = $name; 
$allnotes[] = "</button> </form>";

It seems to me that what you've really wanted was.. (notice the dot operator)

$allnotes[] = "<b>".$name.":"."</b>".$contents."<br>   <form action='notes/delete-note.php' method='post'> <input type='hidden' name='removenote' value='".$name."'> <button type='submit'        class='notedelete'>Delete ".$name."</button> </form>";