PHP button link value not showing

So sorry for my poor english first, I’m not a native,
and stackoverflow says "Failed to upload image; an error occurred on the server"
so I will use a hpyerlink below,
hope I can describe it right,
here is my problem:

I want to replace a button, instead of ahref link,
but I have a problem about showing the text of the button

    while ($row = mysqli_fetch_array($result)) {
        $goods[$i]['PERMNO'] = $row['PERMNO'];
        $goods[$i]['Company_Name'] = $row['Company_Name'];
        $i++;
    }
    foreach ($goods as $value) {
        echo "<tr>";
        echo "<td>" . $value['PERMNO'] . "</td>";
        echo "<td>" . $value['Company_Name'] . "</td>";
       echo "<td><a href=buy.php?PERMNO=" . $value['PERMNO'] .'&select_year='.$select_years.'&formula='.$formula.">新增add</a></td>";
       echo"<td><input type='button' onclick='location.href=buy.php?PERMNO=".$value['PERMNO'] .'&select_year='.$select_years.'&formula='.$formula."/>value='新增add'</td>";
       //echo"<td><button onclick='location.href=buy.php?PERMNO=".$value['PERMNO'] .'&select_year='.$select_years.'&formula='.$formula."/>Green</button></td>";
       
        echo "</tr>";
    }

the image

And if I put the value at the front,
echo"<td><input type='button' value='新增add' onclick='location.href=buy.php?PERMNO=".$value['PERMNO'] .'&select_year='.$select_years.'&formula='.$formula."/></td>";
it looks like this
the image 2

and if I dont use the value by just putting the text in the middle
echo"<td><button onclick='location.href=buy.php?PERMNO=".$value['PERMNO'] .'&select_year='.$select_years.'&formula='.$formula."/>Green</button></td>";

it looks like thisthe image 3

Thank you for reading so far, And if you dont mind, plz help me with it, thanks ALOT!~

>Solution :

You have some problems with your ' and "s in the input tag. Try this instead:

echo "<td><input type='button' onclick='location.href=buy.php?PERMNO=".$value['PERMNO'] ."&select_year=".$select_years."&formula=".$formula."' value='新增add'></td>";

Leave a Reply