Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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>";
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading