dimanche 4 février 2018

If Statement enable / disable [duplicate]

So i have a stop / renew button which if enabled = 1 if disabled = 0

But i get this.

Notice: Undefined variable: action in C:\xampp\htdocs\stress.php on line 370

How would i define that when it's already called a?

            if($stop == 1){ $action = '<form method="post" action=""><button type="submit" name="stopbtn" class="btn btn-danger btn-xs"><i class="fa fa-power-off"></i> Stop</button>'; } else { $stop = ''; }
                                                } else {
        if($renew == 1){ $action = '<button type="submit" name="attackBtn" class="btn btn-success btn-xs">Renew</button>
                                                <input name="host" type="hidden" value="' . htmlspecialchars($ip) . '"/>
                                                <input name="port" type="hidden" value="' . htmlspecialchars($port) . '"/>
                                                <input name="time" type="hidden" value="' . htmlspecialchars($time) . '"/>
                                                <input name="method" type="hidden" value="' . htmlspecialchars($method) . '"/>
                                        </form>'; } else { $renew = ''; }

if($renew == 0 && $stop == 0){ $disableds = 'Disabled'; } else { $disableds = ''; }

    }
    echo '<tr>
    <td style="font-size: 12px;" class="text-center">' . htmlspecialchars($rowID) . '</td>
    <td style="font-size: 12px;" class="text-center">' . htmlspecialchars($ip) . '</td>
    <td style="font-size: 12px;" class="text-center">' . htmlspecialchars($port) . '</td>
    <td style="font-size: 12px;" class="text-center">' . htmlspecialchars($time) . ' Seconds</td>
    <td style="font-size: 12px;" class="text-center">' . htmlspecialchars($method) . '</td>             
    <td style="font-size: 12px;" class="text-center">' . htmlspecialchars_decode($countdown) . '</td>
    <td style="font-size: 12px;" class="text-center">' . htmlspecialchars_decode($action) . '</td>
    </tr>';
}

I'm lost on what I've missed out because it look fine to me but clearly i've missed something

Aucun commentaire:

Enregistrer un commentaire