Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Buttons Ansprechen

Empfohlene Antworten

Veröffentlicht

Hi @all,

ich hab ein Kleines Prob. Eine HTML Seite erstellt, af der sich 3 Buttons befinden.

Jetzt möcht ich, wenn mann z.B.:

Button 1: Hallo

Button 2: Wie gehts

Button 3: Alles klar

Nun habe ich ein Prob bei der aufruf der Buttons gehe ich folgendermassen vor.

Der "value" der Buttons = Variable für PHP das, ich würde gerne den value nicht "ALLE_SYSTEME" nennen,

sondern Alle Systeme (Aktive / Inkative), abe das geht ja nicht, da Variablen namen nicht so erstellt werden können.

Gibt es eine Bessere Möglichkeit die Buttons anzusprechen ???


<html>

<form name="form1" method="post" action="system_liste.php">

  <div align="center"> 

    <table width="100%" border="0">

  <tr>

    <td align="center"><input type="submit" name="aaa" value="ALLE_SYSTEME"></td>

    <td align="center"><input type="submit" name="active" value="AKTIVE_SYSTEME"></td>

    <td align="center"><input type="submit" name="inactive" value="INAKTIVE_SYSTEME"></td>

  </tr>

</table>


  </div>

  <hr>

</form>


<?php


if ($_POST["aaa"] == ALLE_SYSTEME){

echo "<div align=\"center\"><font color=\"#000000\" size=\"+4\"><b><u>Alle Systeme (active / inactive)</u></b></font></div>";

echo "<br>";

echo "<br>";

/* TABELLE **ANFANG** */

echo "<table width=\"817\" border=\"2\" align=\"center\">";

echo "<tr bgcolor=\"#999999\">";

echo "<td width=\"10%\"><div align=\"center\"><font size=\"3\"><b>SYSTEM NAME</b></font></div></td>";

echo "<td width=\"37%\"><div align=\"center\"><font size=\"3\"><b>IP - ADRESSEN</b></font></div></td>";

echo "<td width=\"15%\"><div align=\"center\"><font size=\"3\"><b>LINUX SYSTEM</b></font></div></td>";

echo "<td width=\"14%\"><div align=\"center\"><font size=\"3\"><b>PROZESOREN</b></font></div></td>";

echo "<td width=\"11%\"><div align=\"center\"><font size=\"3\"><b>VIRTUAL RAM</b></font></div></td>";

echo "<td width=\"13%\"><div align=\"center\"><font size=\"3\"><b>STATUS</b></font></div></td>";

echo "</tr>";

/* TABELLE WIRD im Skript /cust/clone/web_clones_status.rexx geschlossen !

/* TABELLE **ENDE** */


$output=shell_exec("/cust/clone/web_clones_status.rexx all");

echo "<pre>$output</pre>";



}


if ($_POST["active"] == AKTIVE_SYSTEME){

echo "<div align=\"center\"><font color=\"#000000\" size=\"+4\"><b><u>Aktive Systeme</u></b></font></div>";

echo "<br>";

echo "<br>";

/* TABELLE **ANFANG** */

echo "<table width=\"817\" border=\"2\" align=\"center\">";

echo "<tr bgcolor=\"#999999\">";

echo "<td width=\"10%\"><div align=\"center\"><font size=\"3\"><b>SYSTEM NAME</b></font></div></td>";

echo "<td width=\"37%\"><div align=\"center\"><font size=\"3\"><b>IP - ADRESSEN</b></font></div></td>";

echo "<td width=\"15%\"><div align=\"center\"><font size=\"3\"><b>LINUX SYSTEM</b></font></div></td>";

echo "<td width=\"14%\"><div align=\"center\"><font size=\"3\"><b>PROZESOREN</b></font></div></td>";

echo "<td width=\"11%\"><div align=\"center\"><font size=\"3\"><b>VIRTUAL RAM</b></font></div></td>";

echo "<td width=\"13%\"><div align=\"center\"><font size=\"3\"><b>STATUS</b></font></div></td>";

echo "</tr>";

/* TABELLE WIRD im Skript /cust/clone/web_clones_status.rexx geschlossen !

/* TABELLE **ENDE** */

$output=shell_exec("/cust/clone/web_clones_status.rexx active");

echo "<pre>$output</pre>";

}


if ($_POST["inactive"] == INAKTIVE_SYSTEME){

echo "<div align=\"center\"><font color=\"#000000\" size=\"+4\"><b><u>Inaktive Systeme</u></b></font></div>";

echo "<br>";

echo "<br>";

/* TABELLE **ANFANG** */

echo "<table width=\"817\" border=\"2\" align=\"center\">";

echo "<tr bgcolor=\"#999999\">";

echo "<td width=\"10%\"><div align=\"center\"><font size=\"3\"><b>SYSTEM NAME</b></font></div></td>";

echo "<td width=\"37%\"><div align=\"center\"><font size=\"3\"><b>IP - ADRESSEN</b></font></div></td>";

echo "<td width=\"15%\"><div align=\"center\"><font size=\"3\"><b>LINUX SYSTEM</b></font></div></td>";

echo "<td width=\"14%\"><div align=\"center\"><font size=\"3\"><b>PROZESOREN</b></font></div></td>";

echo "<td width=\"11%\"><div align=\"center\"><font size=\"3\"><b>VIRTUAL RAM</b></font></div></td>";

echo "<td width=\"13%\"><div align=\"center\"><font size=\"3\"><b>STATUS</b></font></div></td>";

echo "</tr>";

/* TABELLE WIRD im Skript /cust/clone/web_clones_status.rexx geschlossen !

/* TABELLE **ENDE** */


$output=shell_exec("/cust/clone/web_clones_status.rexx inactive");

echo "<pre>$output</pre>";

}


?>

</html>

einfach so:


<form ....>

<input type="submit" name="button1" value="ab damit">

<input type="submit" name="button2" value="ab damit">

<input type="submit" name="button3" value="ab damit">

</form>

dann in php:


if ( isset ($_POST["button1"]) {
// Tabelle 1.....
}

if ( isset ($_POST["button2"]) {
// Tabelle 2.....
}

// usw.
[/PHP]

verständlich?

Gruß

kills

Hi,

ok ich teste das Gleich mal aus ..

Danke für den Tipp

Original geschrieben von geist_der_foren

Der "value" der Buttons = Variable für PHP das, ich würde gerne den value nicht "ALLE_SYSTEME" nennen, sondern Alle Systeme (Aktive / Inkative), abe das geht ja nicht, da Variablen namen nicht so erstellt werden können.

So wie ich das sehe, verwechselst Du da was:

Nicht der Value bestimmt den Variablennamen, sondern der Name.

Also aus <input type="submit" name="aaa" value="ALLE_SYSTEME"> würde werden $aaa="ALLE_SYSTEME"!

Du kannst also ganz beruhigt Deine Auswahl so gestalten:

<input type="submit" name="systeme" value="ALLE SYSTEME">

<input type="submit" name="systeme" value="AKTIVE SYSTEME">

<input type="submit" name="systeme" value="INAKTIVE SYSTEME">

und im Programm abfragen:


switch ($_POST["systeme"])
{
case "ALLE SYSTEME":
//Hier Ausgabe für alle Systeme
break;
case "AKTIVE SYSTEME":
//Hier Ausgabe für aktive Systeme
break;
case "INAKTIVE SYSTEME":
//Hier Ausgabe für inaktive Systeme
break;
default:
//Das hier darf eigentlich nicht passieren
}
[/php]

ICQ

Nachtrag:

Was mir grad noch auffällt: Wirst Du nach Statements bezahlt? ;)

Warum machst Du die gleiche Ausgabe immer mehrfach?

Einfachere Lösung:

[php]
<html>
<form name="form1" method="post" action="system_liste.php">
<div align="center">
<table width="100%" border="0">
<tr>
<td align="center"><input type="submit" name="systeme" value="ALLE SYSTEME"></td>
<td align="center"><input type="submit" name="systeme" value="AKTIVE SYSTEME"></td>
<td align="center"><input type="submit" name="systeme" value="INAKTIVE SYSTEME"></td>
</tr>
</table>

</div>
<hr>
</form>

<?php

switch ($_POST["systeme"])
{
case "ALLE SYSTEME":
$ueberschrift = "Alle Systeme (active / inactive)";
$aufruf = "all";
break;
case "AKTIVE SYSTEME":
$ueberschrift = "Aktive Systeme";
$aufruf = "active";
break;
case "INAKTIVE SYSTEME":
$ueberschrift = "Inaktive Systeme";
$aufruf = "inactive";
break;
}

echo "<div align=\"center\"><font color=\"#000000\" size=\"+4\"><b><u>$ueberschrift</u></b></font></div>";
echo "<br>";
echo "<br>";
/* TABELLE **ANFANG** */
echo "<table width=\"817\" border=\"2\" align=\"center\">";
echo "<tr bgcolor=\"#999999\">";
echo "<td width=\"10%\"><div align=\"center\"><font size=\"3\"><b>SYSTEM NAME</b></font></div></td>";
echo "<td width=\"37%\"><div align=\"center\"><font size=\"3\"><b>IP - ADRESSEN</b></font></div></td>";
echo "<td width=\"15%\"><div align=\"center\"><font size=\"3\"><b>LINUX SYSTEM</b></font></div></td>";
echo "<td width=\"14%\"><div align=\"center\"><font size=\"3\"><b>PROZESOREN</b></font></div></td>";
echo "<td width=\"11%\"><div align=\"center\"><font size=\"3\"><b>VIRTUAL RAM</b></font></div></td>";
echo "<td width=\"13%\"><div align=\"center\"><font size=\"3\"><b>STATUS</b></font></div></td>";
echo "</tr>";
/* TABELLE WIRD im Skript /cust/clone/web_clones_status.rexx geschlossen !
/* TABELLE **ENDE** */

$output=shell_exec("/cust/clone/web_clones_status.rexx $aufruf");
echo "<pre>$output</pre>";
?>
</html>

Damit hättest Du nur eine(!) Ausgabe anstatt drei!

ICQ - zum zweiten *g*

@ICQ

das ist natürlich eine Sauberere Lösung ... Danke ..

Aber wie ist das wenn ich die einen value="ALLE SYSTEM (Active / Inactive) nehm ?

Kann ich dann auch so ansprechen:


switch ($_POST["systeme"]) 


{


    [COLOR=red]case "ALLE SYSTEM (Active / Inactive)":[/COLOR] 


        $ueberschrift = "Alle Systeme (active / inactive)";


        $aufruf = "all";


        break;


u. s. w. 

}

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.