Seven Secrets
Erfahrenes Mitglied
Hallo,
ich habe folgendes Script geschrieben, bei dem in die entpsrechenden Textfelder der Inhalt von einem Datensatz eingetragen wird. Danach sollen die bearbeiteten Werte gespeichert werde, was aus irgendeinem Grund nicht funktioniert.
ich habe folgendes Script geschrieben, bei dem in die entpsrechenden Textfelder der Inhalt von einem Datensatz eingetragen wird. Danach sollen die bearbeiteten Werte gespeichert werde, was aus irgendeinem Grund nicht funktioniert.
PHP:
/* List the offers in the database for editng. */
Function Update_Listing () {
echo "<FORM METHOD=\"POST\" ACTION=\"offers-admin.php\">";
$result = mysql_query("SELECT uid, desguation, description, places, free, payment, age, worktime FROM care_offers ORDER BY desguation");
echo "<TABLE BORDER = 1 CELLPADDING = 2 CELLSPACING = 3>";
$total_rows = mysql_num_rows($result); $counter = 0;
echo "<TR><TD class=\"inhalt\"><B>Auswahl</TD>
<TD class=\"inhalt\"><B>Bezeichnung</TD>
<TD class=\"inhalt\"><B>Beschreibung</TD>
</TR>";
while($counter < $total_rows):
$uid = mysql_result($result,$counter,"uid");
echo "<TR><TD class=\"inhalt\"><div align=\"center\">";
echo "<INPUT TYPE=\"radio\" NAME=\"uid\" VALUE=\"$uid\">";
echo "</TD>";
echo "<TD WIDTH=\"160\" VALIGN=\"top\" class=\"inhalt\">";
echo mysql_result($result,$counter,"desguation");
echo "</TD>";
echo "<TD class=\"inhalt\"><div align=\"justify\">";
echo mysql_result($result,$counter,"description");
echo "</div><br>";
echo "<b>freie Stellen:</b> ". mysql_result($result,$counter,"places");
echo "<br><b>frei ab: </b> ". mysql_result($result,$counter,"free");
echo "<br><b>Bezahlung: </b> ". mysql_result($result,$counter,"payment");
echo "<br><b>Alter: </b> ". mysql_result($result,$counter,"age");
echo "<br><b>Arbeitszeit: </b> ". mysql_result($result,$counter,"worktime");
echo "<br><br></TD></TR>";
$counter = $counter + 1;
endwhile;
echo "</TABLE><br>";
echo "<INPUT TYPE = \"hidden\" NAME = \"state\" VALUE = \"Update_Now\">\n";
echo "<INPUT TYPE=\"submit\" VALUE=\"Ausführen\">";
};
/* Save updates to database. */
Function Commit_Update ($uid, $desguation, $description, $places, $free, $payment, $age, $worktime){
$result = mysql_query("UPDATE care_offers SET desguation = '$desguation', description = '$description', places = '$places', free ='$free', paymnet ='$payment', age ='$age', worktime ='$worktime', WHERE uid = '".$uid."';");
$state = "";
Print_Offer($uid);
};
/* Save new contact information to database. */
Function Commit_Save ($desguation, $description, $places, $free, $payment, $age, $worktime) {
$result = mysql_query("INSERT INTO care_offers (desguation, description, places, free, payment, age, worktime) VALUES ('$desguation', '$description', '$places', '$free', '$payment', '$age', '$worktime')");
$uid = mysql_insert_id();
$state = "";
Print_Offer($uid);
};
/* This function displays the contact Information in a form. It is used for both the create and update contact options. */
Function Offers_Form ($state, $uid){
if($state == "Update_Now"){
$state = "Commit_Update";
$result = mysql_query("SELECT * FROM care_offers WHERE uid = '".$uid."';");
$desguation = mysql_result($result,0,"desguation");
$description = mysql_result($result,0,"description");
$places = mysql_result($result,0,"places");
$free = mysql_result($result,0,"free");
$payment = mysql_result($result,0,"payment");
$age = mysql_result($result,0,"age");
$worktime = mysql_result($result,0,"worktime");
}
else {
$state = "Commit_Save";
}
echo "<div align=\"center\">Angebot eingeben </div>
<FORM METHOD = \"POST\" ACTION=\"offers-admin.php\">
<p align=\"center\">
<INPUT TYPE = \"HIDDEN\" NAME = \"uid\" VALUE = \"$uid\">
<INPUT TYPE = \"HIDDEN\" NAME = \"state\" VALUE = \"$state\">
</p>
<p align=\"center\">Bezeichnung:  
<INPUT TYPE = \"TEXT\" NAME=\"desguation\" VALUE = \"$desguation\">
</p>
<p align=\"center\"> Beschreibung:                                       <br>
<BR>
<textarea name=\"description\" VALUE = \"$description\" cols=\"35\" rows=\"5\">".$description."</textarea>
</p>
<p align=\"center\"> offene Stellen:
<INPUT TYPE = \"TEXT\" NAME=\"places\" VALUE = \"$places\">
</p>
<p align=\"center\"> frai ab:           
<INPUT TYPE = \"TEXT\" NAME=\"free\" VALUE = \"$free\">
</p>
<p align=\"center\"> Gehalt:           
<INPUT TYPE = \"TEXT\" NAME=\"payment\" VALUE = \"$payment\">
</p>
<p align=\"center\"> Alter:             
<INPUT TYPE = \"TEXT\" NAME=\"age\" VALUE = \"$age\">
</p>
<p align=\"center\"> Arbeitszeit:     
<INPUT TYPE = \"TEXT\" NAME=\"worktime\" VALUE = \"$worktime\">
<br>
<br>
<INPUT TYPE=\"submit\" VALUE=\"Speichern\">
</p>";
};