adding a button on an Echo that produces rows

44
December 08, 2019, at 10:10 AM

i've made an echo that produces a table in the correct format based on the data its echo'ing. However on the same line of each echo, i'd like to add a button that is on the same row, and linked to that row of data.

echo "\t<tr><td>". $row["Title"]. " </td><td> ". 
$row["PerfDate"]. " </td><td> " . $row["PerfTime"] . " </td><td> " . $row[button] . "</td> 
</tr>\n" ;

above is the echo, there are three "rows" being echoed out and being placed correctly into a table. How do i place a button in there too so that each time it produces a new set, that set has a button linked to it?

Many thanks

Answer 1

Try this:

    echo '<tr>
    <td>'.$row['Title'].'</td>
    <td>'.$row['PerfDate'].'</td>
    <td>'.$row['PerfTime'].'</td>
    <td><button onClick="doit()" name="'.$row['Title'].'" value="'.$row['Title'].'"></button></td> 
    </tr>
    <script>
      function doit(){
        window.open("https://www.w3schools.com"); 
      }
    </script>';

updated :) || updated again :)

READ ALSO
convert unknown time format to english time format dd/mm/yyyy in PHP [duplicate]

convert unknown time format to english time format dd/mm/yyyy in PHP [duplicate]

Given an unknown time format like "1574550000" or "1543616635" in a db column formatted with biginit(16) I need it to convert it in PHP to english time format like dd/mm/yyyy

58
Get data from multiple array in Controller

Get data from multiple array in Controller

I have country list in array with multiple array, like:

27
Parsing JSON in PHP using json_decode

Parsing JSON in PHP using json_decode

I'm trying to get request from web service which insert my data in Json formatMy PHP code which is not succeed is shown below:

47
How to get results of more than one condition at a time

How to get results of more than one condition at a time

I even don't know how to ask my question!

58