how can I make each <tr> clickable in php?


i have the following code in php using laravel blade which allows me to get all the days of the current month as a table , I want to make each "" clickable with php , im not sure if thats possible.

    <table class="table-bordered">
$date = date('F Y');//Current Month Year

while (strtotime($date) <= strtotime(date('Y-m') . '-' . date('t', strtotime($date)))) {
        echo "<tr>";
    $day_num = date('j', strtotime($date));
    $month_num = date('m', strtotime($date));
    $day_name = date('l', strtotime($date));
    $day_abrev = date('S', strtotime($date));
    $day = "$day_name $day_num";
    $date = date("Y-m-d", strtotime("+1 day", strtotime($date)));
    echo '<td>' . $day . '</td>';
           echo "</tr>";

>Solution :

If you want make the <tr> clickable, just echo "<tr onclick='your_js_function_name_or_code'>";.

For example if you want alert, just echo "<tr onclick='alert(1)'>";.

Leave a ReplyCancel reply