Variablen - Problem

Lektor21

Erfahrenes Mitglied
Hallo!

In meinem folgenden Script werden meine Formulareingaben nicht richtig an das Script übergeben, was die Daten an die DB schickt!

Definiere ich selber die Variable, also z.B. $Wartung = "Test" wird sie eingetragen!

Ich denke mal ich habe irgendwo einen kleinen Fehler drin! Suche nun schon seit 2 Stunden und finde den Fehler nicht! Bitte helft mit :confused:

PHP:
if ($_POST["uebernehmen_wartung"])
    {

    mysql_query(" UPDATE data SET wartung = '$wartung_new' ");    
    
    } 


    echo "<b>$wartung $wartung_new</b>";


    echo "
    <tr bgcolor='#DCDCDC'><td colspan='3' valign='top'><br><font color='#FF0000'><b>Wartung</b></font><br><br>
    <form method='POST' action='admin.php'>
    <table border='0'>
    <tr>
    <td><b>Modus &auml;ndern:</b></td>
    <td>
    <select value='$wartung' name='wartung_new' onChange='this.style.color=this.options[this.selectedIndex].style.color'>";

    if ($wartung == "no"){
    echo "<option style='color:#008000; font-weight: bold;' value='no' selected>Normal</option>\n<option style='color:#FF0000; font-weight: bold;' value='yes'>Wartungsmodus</option>\n<option style='color:#0000FF; font-weight: bold;' value='auto'>Automatisch</option>";
    }

    elseif ($wartung == "yes"){
    echo "<option style='color:#008000; font-weight: bold;' value='no'>Normal</option>\n<option style='color:#FF0000; font-weight: bold;' value='yes' selected>Wartungsmodus</option>\n<option style='color:#0000FF; font-weight: bold;' value='auto'>Automatisch</option>";
    }

    elseif ($wartung == "auto"){
    echo "<option style='color:#008000; font-weight: bold;' value='no'>Normal</option>\n<option style='color:#FF0000; font-weight: bold;' value='yes'>Wartungsmodus</option>\n<option style='color:#0000FF; font-weight: bold;' value='auto' selected>Automatisch</option>";
    }

    ?>

    </select>
    </td>
    </tr>
    <tr>
    <td colspan='2'><p>&nbsp;</p></td>
    </tr>
    <td><b>Wartung vom:</b></td>
    <td>
    <input type='text' value='<?php echo("$wartung_from_date"); ?>' name='wartung_from_date_new' size='10' maxlength='10'>
    &nbsp;
    <select name='wartung_from_time' value='<?php echo("$wartung_from_time"); ?>'>
<option value="00:00" <?=$wartung_from_time == "00:00" ? "selected" : "";?>>00:00</option>
<option value="00:15" <?=$wartung_from_time == "00:15" ? "selected" : "";?>>00:15</option>
<option value="00:30" <?=$wartung_from_time == "00:30" ? "selected" : "";?>>00:30</option>
<option value="00:45" <?=$wartung_from_time == "00:45" ? "selected" : "";?>>00:45</option>
<option value="01:00" <?=$wartung_from_time == "01:00" ? "selected" : "";?>>01:00</option>
<option value="01:15" <?=$wartung_from_time == "01:15" ? "selected" : "";?>>01:15</option>
<option value="01:30" <?=$wartung_from_time == "01:30" ? "selected" : "";?>>01:30</option>
<option value="01:45" <?=$wartung_from_time == "01:45" ? "selected" : "";?>>01:45</option>
<option value="02:00" <?=$wartung_from_time == "02:00" ? "selected" : "";?>>02:00</option>
<option value="02:15" <?=$wartung_from_time == "02:15" ? "selected" : "";?>>02:15</option>
<option value="02:30" <?=$wartung_from_time == "02:30" ? "selected" : "";?>>02:30</option>
<option value="02:45" <?=$wartung_from_time == "02:45" ? "selected" : "";?>>02:45</option>
<option value="03:00" <?=$wartung_from_time == "03:00" ? "selected" : "";?>>03:00</option>
<option value="03:15" <?=$wartung_from_time == "03:15" ? "selected" : "";?>>03:15</option>
<option value="03:30" <?=$wartung_from_time == "03:30" ? "selected" : "";?>>03:30</option>
<option value="03:45" <?=$wartung_from_time == "03:45" ? "selected" : "";?>>03:45</option>
<option value="04:00" <?=$wartung_from_time == "04:00" ? "selected" : "";?>>04:00</option>
<option value="04:15" <?=$wartung_from_time == "04:15" ? "selected" : "";?>>04:15</option>
<option value="04:30" <?=$wartung_from_time == "04:30" ? "selected" : "";?>>04:30</option>
<option value="04:45" <?=$wartung_from_time == "04:45" ? "selected" : "";?>>04:45</option>
<option value="05:00" <?=$wartung_from_time == "05:00" ? "selected" : "";?>>05:00</option>
<option value="05:15" <?=$wartung_from_time == "05:15" ? "selected" : "";?>>05:15</option>
<option value="05:30" <?=$wartung_from_time == "05:30" ? "selected" : "";?>>05:30</option>
<option value="05:45" <?=$wartung_from_time == "05:45" ? "selected" : "";?>>05:45</option>
<option value="06:00" <?=$wartung_from_time == "06:00" ? "selected" : "";?>>06:00</option>
<option value="06:15" <?=$wartung_from_time == "06:15" ? "selected" : "";?>>06:15</option>
<option value="06:30" <?=$wartung_from_time == "06:30" ? "selected" : "";?>>06:30</option>
<option value="06:45" <?=$wartung_from_time == "06:45" ? "selected" : "";?>>06:45</option>
<option value="07:00" <?=$wartung_from_time == "07:00" ? "selected" : "";?>>07:00</option>
<option value="07:15" <?=$wartung_from_time == "07:15" ? "selected" : "";?>>07:15</option>
<option value="07:30" <?=$wartung_from_time == "07:30" ? "selected" : "";?>>07:30</option>
<option value="07:45" <?=$wartung_from_time == "07:45" ? "selected" : "";?>>07:45</option>
<option value="08:00" <?=$wartung_from_time == "08:00" ? "selected" : "";?>>08:00</option>
<option value="08:15" <?=$wartung_from_time == "08:15" ? "selected" : "";?>>08:15</option>
<option value="08:30" <?=$wartung_from_time == "08:30" ? "selected" : "";?>>08:30</option>
<option value="08:45" <?=$wartung_from_time == "08:45" ? "selected" : "";?>>08:45</option>
<option value="09:00" <?=$wartung_from_time == "09:00" ? "selected" : "";?>>09:00</option>
<option value="09:15" <?=$wartung_from_time == "09:15" ? "selected" : "";?>>09:15</option>
<option value="09:30" <?=$wartung_from_time == "09:30" ? "selected" : "";?>>09:30</option>
<option value="09:45" <?=$wartung_from_time == "09:45" ? "selected" : "";?>>09:45</option>
<option value="10:00" <?=$wartung_from_time == "10:00" ? "selected" : "";?>>10:00</option>
<option value="10:15" <?=$wartung_from_time == "10:15" ? "selected" : "";?>>10:15</option>
<option value="10:30" <?=$wartung_from_time == "10:30" ? "selected" : "";?>>10:30</option>
<option value="10:45" <?=$wartung_from_time == "10:45" ? "selected" : "";?>>10:45</option>
<option value="11:00" <?=$wartung_from_time == "11:00" ? "selected" : "";?>>11:00</option>
<option value="11:15" <?=$wartung_from_time == "11:15" ? "selected" : "";?>>11:15</option>
<option value="11:30" <?=$wartung_from_time == "11:30" ? "selected" : "";?>>11:30</option>
<option value="11:45" <?=$wartung_from_time == "11:45" ? "selected" : "";?>>11:45</option>
<option value="12:00" <?=$wartung_from_time == "12:00" ? "selected" : "";?>>12:00</option>
<option value="12:15" <?=$wartung_from_time == "12:15" ? "selected" : "";?>>12:15</option>
<option value="12:30" <?=$wartung_from_time == "12:30" ? "selected" : "";?>>12:30</option>
<option value="12:45" <?=$wartung_from_time == "12:45" ? "selected" : "";?>>12:45</option>
<option value="13:00" <?=$wartung_from_time == "13:00" ? "selected" : "";?>>13:00</option>
<option value="13:15" <?=$wartung_from_time == "13:15" ? "selected" : "";?>>13:15</option>
<option value="13:30" <?=$wartung_from_time == "13:30" ? "selected" : "";?>>13:30</option>
<option value="13:45" <?=$wartung_from_time == "13:45" ? "selected" : "";?>>13:45</option>
<option value="14:00" <?=$wartung_from_time == "14:00" ? "selected" : "";?>>14:00</option>
<option value="14:15" <?=$wartung_from_time == "14:15" ? "selected" : "";?>>14:15</option>
<option value="14:30" <?=$wartung_from_time == "14:30" ? "selected" : "";?>>14:30</option>
<option value="14:45" <?=$wartung_from_time == "14:45" ? "selected" : "";?>>14:45</option>
<option value="15:00" <?=$wartung_from_time == "15:00" ? "selected" : "";?>>15:00</option>
<option value="15:15" <?=$wartung_from_time == "15:15" ? "selected" : "";?>>15:15</option>
<option value="15:30" <?=$wartung_from_time == "15:30" ? "selected" : "";?>>15:30</option>
<option value="15:45" <?=$wartung_from_time == "15:45" ? "selected" : "";?>>15:45</option>
<option value="16:00" <?=$wartung_from_time == "16:00" ? "selected" : "";?>>16:00</option>
<option value="16:15" <?=$wartung_from_time == "16:15" ? "selected" : "";?>>16:15</option>
<option value="16:30" <?=$wartung_from_time == "16:30" ? "selected" : "";?>>16:30</option>
<option value="16:45" <?=$wartung_from_time == "16:45" ? "selected" : "";?>>16:45</option>
<option value="17:00" <?=$wartung_from_time == "17:00" ? "selected" : "";?>>17:00</option>
<option value="17:15" <?=$wartung_from_time == "17:15" ? "selected" : "";?>>17:15</option>
<option value="17:30" <?=$wartung_from_time == "17:30" ? "selected" : "";?>>17:30</option>
<option value="17:45" <?=$wartung_from_time == "17:45" ? "selected" : "";?>>17:45</option>
<option value="18:00" <?=$wartung_from_time == "18:00" ? "selected" : "";?>>18:00</option>
<option value="18:15" <?=$wartung_from_time == "18:15" ? "selected" : "";?>>18:15</option>
<option value="18:30" <?=$wartung_from_time == "18:30" ? "selected" : "";?>>18:30</option>
<option value="18:45" <?=$wartung_from_time == "18:45" ? "selected" : "";?>>18:45</option>
<option value="19:00" <?=$wartung_from_time == "19:00" ? "selected" : "";?>>19:00</option>
<option value="19:15" <?=$wartung_from_time == "19:15" ? "selected" : "";?>>19:15</option>
<option value="19:30" <?=$wartung_from_time == "19:30" ? "selected" : "";?>>19:30</option>
<option value="19:45" <?=$wartung_from_time == "19:45" ? "selected" : "";?>>19:45</option>
<option value="20:00" <?=$wartung_from_time == "20:00" ? "selected" : "";?>>20:00</option>
<option value="20:15" <?=$wartung_from_time == "20:15" ? "selected" : "";?>>20:15</option>
<option value="20:30" <?=$wartung_from_time == "20:30" ? "selected" : "";?>>20:30</option>
<option value="20:45" <?=$wartung_from_time == "20:45" ? "selected" : "";?>>20:45</option>
<option value="21:00" <?=$wartung_from_time == "21:00" ? "selected" : "";?>>21:00</option>
<option value="21:15" <?=$wartung_from_time == "21:15" ? "selected" : "";?>>21:15</option>
<option value="21:30" <?=$wartung_from_time == "21:30" ? "selected" : "";?>>21:30</option>
<option value="21:45" <?=$wartung_from_time == "21:45" ? "selected" : "";?>>21:45</option>
<option value="22:00" <?=$wartung_from_time == "22:00" ? "selected" : "";?>>22:00</option>
<option value="22:15" <?=$wartung_from_time == "22:15" ? "selected" : "";?>>22:15</option>
<option value="22:30" <?=$wartung_from_time == "22:30" ? "selected" : "";?>>22:30</option>
<option value="22:45" <?=$wartung_from_time == "22:45" ? "selected" : "";?>>22:45</option>
<option value="23:00" <?=$wartung_from_time == "23:00" ? "selected" : "";?>>23:00</option>
<option value="23:15" <?=$wartung_from_time == "23:15" ? "selected" : "";?>>23:15</option>
<option value="23:30" <?=$wartung_from_time == "23:30" ? "selected" : "";?>>23:30</option>
<option value="23:45" <?=$wartung_from_time == "23:45" ? "selected" : "";?>>23:45</option>
</select> Uhr
</td>
</tr>
<tr>
<td><b>Wartung bis:</b></td>
<td>
<input type='text' value='<?php echo("$wartung_to_date"); ?>' name='wartung_to_date' size='10' maxlength='10'>
&nbsp;
<select name='wartung_to_time' value='<?php echo("$wartung_to_time"); ?>'>
<option value="00:00" <?=$wartung_to_time == "00:00" ? "selected" : "";?>>00:00</option>
<option value="00:15" <?=$wartung_to_time == "00:15" ? "selected" : "";?>>00:15</option>
<option value="00:30" <?=$wartung_to_time == "00:30" ? "selected" : "";?>>00:30</option>
<option value="00:45" <?=$wartung_to_time == "00:45" ? "selected" : "";?>>00:45</option>
<option value="01:00" <?=$wartung_to_time == "01:00" ? "selected" : "";?>>01:00</option>
<option value="01:15" <?=$wartung_to_time == "01:15" ? "selected" : "";?>>01:15</option>
<option value="01:30" <?=$wartung_to_time == "01:30" ? "selected" : "";?>>01:30</option>
<option value="01:45" <?=$wartung_to_time == "01:45" ? "selected" : "";?>>01:45</option>
<option value="02:00" <?=$wartung_to_time == "02:00" ? "selected" : "";?>>02:00</option>
<option value="02:15" <?=$wartung_to_time == "02:15" ? "selected" : "";?>>02:15</option>
<option value="02:30" <?=$wartung_to_time == "02:30" ? "selected" : "";?>>02:30</option>
<option value="02:45" <?=$wartung_to_time == "02:45" ? "selected" : "";?>>02:45</option>
<option value="03:00" <?=$wartung_to_time == "03:00" ? "selected" : "";?>>03:00</option>
<option value="03:15" <?=$wartung_to_time == "03:15" ? "selected" : "";?>>03:15</option>
<option value="03:30" <?=$wartung_to_time == "03:30" ? "selected" : "";?>>03:30</option>
<option value="03:45" <?=$wartung_to_time == "03:45" ? "selected" : "";?>>03:45</option>
<option value="04:00" <?=$wartung_to_time == "04:00" ? "selected" : "";?>>04:00</option>
<option value="04:15" <?=$wartung_to_time == "04:15" ? "selected" : "";?>>04:15</option>
<option value="04:30" <?=$wartung_to_time == "04:30" ? "selected" : "";?>>04:30</option>
<option value="04:45" <?=$wartung_to_time == "04:45" ? "selected" : "";?>>04:45</option>
<option value="05:00" <?=$wartung_to_time == "05:00" ? "selected" : "";?>>05:00</option>
<option value="05:15" <?=$wartung_to_time == "05:15" ? "selected" : "";?>>05:15</option>
<option value="05:30" <?=$wartung_to_time == "05:30" ? "selected" : "";?>>05:30</option>
<option value="05:45" <?=$wartung_to_time == "05:45" ? "selected" : "";?>>05:45</option>
<option value="06:00" <?=$wartung_to_time == "06:00" ? "selected" : "";?>>06:00</option>
<option value="06:15" <?=$wartung_to_time == "06:15" ? "selected" : "";?>>06:15</option>
<option value="06:30" <?=$wartung_to_time == "06:30" ? "selected" : "";?>>06:30</option>
<option value="06:45" <?=$wartung_to_time == "06:45" ? "selected" : "";?>>06:45</option>
<option value="07:00" <?=$wartung_to_time == "07:00" ? "selected" : "";?>>07:00</option>
<option value="07:15" <?=$wartung_to_time == "07:15" ? "selected" : "";?>>07:15</option>
<option value="07:30" <?=$wartung_to_time == "07:30" ? "selected" : "";?>>07:30</option>
<option value="07:45" <?=$wartung_to_time == "07:45" ? "selected" : "";?>>07:45</option>
<option value="08:00" <?=$wartung_to_time == "08:00" ? "selected" : "";?>>08:00</option>
<option value="08:15" <?=$wartung_to_time == "08:15" ? "selected" : "";?>>08:15</option>
<option value="08:30" <?=$wartung_to_time == "08:30" ? "selected" : "";?>>08:30</option>
<option value="08:45" <?=$wartung_to_time == "08:45" ? "selected" : "";?>>08:45</option>
<option value="09:00" <?=$wartung_to_time == "09:00" ? "selected" : "";?>>09:00</option>
<option value="09:15" <?=$wartung_to_time == "09:15" ? "selected" : "";?>>09:15</option>
<option value="09:30" <?=$wartung_to_time == "09:30" ? "selected" : "";?>>09:30</option>
<option value="09:45" <?=$wartung_to_time == "09:45" ? "selected" : "";?>>09:45</option>
<option value="10:00" <?=$wartung_to_time == "10:00" ? "selected" : "";?>>10:00</option>
<option value="10:15" <?=$wartung_to_time == "10:15" ? "selected" : "";?>>10:15</option>
<option value="10:30" <?=$wartung_to_time == "10:30" ? "selected" : "";?>>10:30</option>
<option value="10:45" <?=$wartung_to_time == "10:45" ? "selected" : "";?>>10:45</option>
<option value="11:00" <?=$wartung_to_time == "11:00" ? "selected" : "";?>>11:00</option>
<option value="11:15" <?=$wartung_to_time == "11:15" ? "selected" : "";?>>11:15</option>
<option value="11:30" <?=$wartung_to_time == "11:30" ? "selected" : "";?>>11:30</option>
<option value="11:45" <?=$wartung_to_time == "11:45" ? "selected" : "";?>>11:45</option>
<option value="12:00" <?=$wartung_to_time == "12:00" ? "selected" : "";?>>12:00</option>
<option value="12:15" <?=$wartung_to_time == "12:15" ? "selected" : "";?>>12:15</option>
<option value="12:30" <?=$wartung_to_time == "12:30" ? "selected" : "";?>>12:30</option>
<option value="12:45" <?=$wartung_to_time == "12:45" ? "selected" : "";?>>12:45</option>
<option value="13:00" <?=$wartung_to_time == "13:00" ? "selected" : "";?>>13:00</option>
<option value="13:15" <?=$wartung_to_time == "13:15" ? "selected" : "";?>>13:15</option>
<option value="13:30" <?=$wartung_to_time == "13:30" ? "selected" : "";?>>13:30</option>
<option value="13:45" <?=$wartung_to_time == "13:45" ? "selected" : "";?>>13:45</option>
<option value="14:00" <?=$wartung_to_time == "14:00" ? "selected" : "";?>>14:00</option>
<option value="14:15" <?=$wartung_to_time == "14:15" ? "selected" : "";?>>14:15</option>
<option value="14:30" <?=$wartung_to_time == "14:30" ? "selected" : "";?>>14:30</option>
<option value="14:45" <?=$wartung_to_time == "14:45" ? "selected" : "";?>>14:45</option>
<option value="15:00" <?=$wartung_to_time == "15:00" ? "selected" : "";?>>15:00</option>
<option value="15:15" <?=$wartung_to_time == "15:15" ? "selected" : "";?>>15:15</option>
<option value="15:30" <?=$wartung_to_time == "15:30" ? "selected" : "";?>>15:30</option>
<option value="15:45" <?=$wartung_to_time == "15:45" ? "selected" : "";?>>15:45</option>
<option value="16:00" <?=$wartung_to_time == "16:00" ? "selected" : "";?>>16:00</option>
<option value="16:15" <?=$wartung_to_time == "16:15" ? "selected" : "";?>>16:15</option>
<option value="16:30" <?=$wartung_to_time == "16:30" ? "selected" : "";?>>16:30</option>
<option value="16:45" <?=$wartung_to_time == "16:45" ? "selected" : "";?>>16:45</option>
<option value="17:00" <?=$wartung_to_time == "17:00" ? "selected" : "";?>>17:00</option>
<option value="17:15" <?=$wartung_to_time == "17:15" ? "selected" : "";?>>17:15</option>
<option value="17:30" <?=$wartung_to_time == "17:30" ? "selected" : "";?>>17:30</option>
<option value="17:45" <?=$wartung_to_time == "17:45" ? "selected" : "";?>>17:45</option>
<option value="18:00" <?=$wartung_to_time == "18:00" ? "selected" : "";?>>18:00</option>
<option value="18:15" <?=$wartung_to_time == "18:15" ? "selected" : "";?>>18:15</option>
<option value="18:30" <?=$wartung_to_time == "18:30" ? "selected" : "";?>>18:30</option>
<option value="18:45" <?=$wartung_to_time == "18:45" ? "selected" : "";?>>18:45</option>
<option value="19:00" <?=$wartung_to_time == "19:00" ? "selected" : "";?>>19:00</option>
<option value="19:15" <?=$wartung_to_time == "19:15" ? "selected" : "";?>>19:15</option>
<option value="19:30" <?=$wartung_to_time == "19:30" ? "selected" : "";?>>19:30</option>
<option value="19:45" <?=$wartung_to_time == "19:45" ? "selected" : "";?>>19:45</option>
<option value="20:00" <?=$wartung_to_time == "20:00" ? "selected" : "";?>>20:00</option>
<option value="20:15" <?=$wartung_to_time == "20:15" ? "selected" : "";?>>20:15</option>
<option value="20:30" <?=$wartung_to_time == "20:30" ? "selected" : "";?>>20:30</option>
<option value="20:45" <?=$wartung_to_time == "20:45" ? "selected" : "";?>>20:45</option>
<option value="21:00" <?=$wartung_to_time == "21:00" ? "selected" : "";?>>21:00</option>
<option value="21:15" <?=$wartung_to_time == "21:15" ? "selected" : "";?>>21:15</option>
<option value="21:30" <?=$wartung_to_time == "21:30" ? "selected" : "";?>>21:30</option>
<option value="21:45" <?=$wartung_to_time == "21:45" ? "selected" : "";?>>21:45</option>
<option value="22:00" <?=$wartung_to_time == "22:00" ? "selected" : "";?>>22:00</option>
<option value="22:15" <?=$wartung_to_time == "22:15" ? "selected" : "";?>>22:15</option>
<option value="22:30" <?=$wartung_to_time == "22:30" ? "selected" : "";?>>22:30</option>
<option value="22:45" <?=$wartung_to_time == "22:45" ? "selected" : "";?>>22:45</option>
<option value="23:00" <?=$wartung_to_time == "23:00" ? "selected" : "";?>>23:00</option>
<option value="23:15" <?=$wartung_to_time == "23:15" ? "selected" : "";?>>23:15</option>
<option value="23:30" <?=$wartung_to_time == "23:30" ? "selected" : "";?>>23:30</option>
<option value="23:45" <?=$wartung_to_time == "23:45" ? "selected" : "";?>>23:45</option>
</select> Uhr
</td>
</tr>
<tr>
<td colspan='2'><p>&nbsp;</p></td>
</tr>
<tr>
<td colspan='2' align='right'>
<input type='submit' class='button' name='uebernehmen_wartung' value='Übernehmen'>
</form>
</td>
</tr>
</table>



<?php



echo "</td></tr>";
    }

?>
 
Hallo,

vielleicht solltest du nicht mit globalen Variablen arbeiten:

statt
PHP:
$wartung_new
PHP:
$_POST['wartung_new']

Gruß
jojomp
 
Zurück