T
tender89
Gast
Hallo Leute.
Ich steh mal wieder aufm Zweig. ^^
Ich habe ein Gästebuch Gebaut. Doch will ich jetzt Ein "Capture" einbauen .
Also befor man auf Eintragen klickt Soll man zb 44-22 berechnen und in ein feld eintragen.
Hier mal der submint block mit der eingabe.
so sieht das aus :
hier mal der PhP eintrage/submint code
kann mir vllt jemand helfen den if else code zu entwickeln ?? das erste mal ist es immer schwer...
danke schonmal =)!
Ich steh mal wieder aufm Zweig. ^^
Ich habe ein Gästebuch Gebaut. Doch will ich jetzt Ein "Capture" einbauen .
Also befor man auf Eintragen klickt Soll man zb 44-22 berechnen und in ein feld eintragen.
Hier mal der submint block mit der eingabe.
HTML:
<form action="<?php echo $_REQUEST["PHP_SELF"]; ?>" method="POST" >
<p></p>
<table width="639" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="beschr_hell" align="left" valign="top" bgcolor="#666666" width="80">Datum</td>
<td class="beschr_hell" align="left" valign="top" bgcolor="#666666" width="363"> </td>
<td class="beschr_hell" align="left" valign="top" bgcolor="#666666" width="95"> </td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#cccccc" width="80"><?php echo date("d.m.Y"); ?></td>
<td align="left" valign="top" bgcolor="#cccccc" width="363"> </td>
<td align="left" valign="top" bgcolor="#cccccc" width="95"> </td>
</tr>
<tr>
<td class="beschr_hell" align="left" valign="top" bgcolor="#999999" width="80">Text</td>
<td colspan="2" align="left" valign="top" bgcolor="#cccccc" width="462">
<p class="fliesstext"><textarea name="form_text" rows="2" cols="65"></textarea></p>
</td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#999999" width="80"> </td>
<td align="left" valign="top" bgcolor="#cccccc" width="363"> </td>
<td align="left" valign="top" bgcolor="#cccccc" width="95"> </td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#999999" width="80"><input type="hidden" name="do" value="insert"></td>
<td align="left" valign="top" bgcolor="#cccccc" width="363"><input type="submit" name="submit" value="eintragen" border="0"></td>
<td align="left" valign="top" bgcolor="#cccccc" width="95"> </td>
</tr>
</table>
</form>
so sieht das aus :

hier mal der PhP eintrage/submint code
PHP:
// Zum Eintragen neuer Datensätze in das Gästebuch
// Prüfen, ob sich die Seite selbst aufgerufen hat
if ( isset($_REQUEST["do"]) && $_REQUEST["do"] == "insert" )
{
// Die Seite hat sich selbst aufgerufen
// Pflichtfeldkontrolle
$error_msg = "";
if ( $_REQUEST["form_text"] == "" )
{
$error_msg .= "Bitte geben Sie einen Text an.<br>";
}
if ( $error_msg == "")
{
// Alles o.k.
$datum = date("d.m.Y");
// Datenbank-Zugriff
mysqlconnect();
// INSERT
$query = "INSERT INTO allgemein (text, datum ) VALUES ( ";
$query .= " '" . $_REQUEST["form_text"] . "', ";
$query .= " '" . $datum . "' ";
$query .= " ) " ;
// In die Datenbank eintragen
$result = mysql_query( $query );
if ( ! $result )
{
die("Konnte den Datensatz nicht eintragen: " . mysql_error() );
}
// Wechsel auf main
header("Location: index.php");
die;
}
kann mir vllt jemand helfen den if else code zu entwickeln ?? das erste mal ist es immer schwer...
danke schonmal =)!
Zuletzt bearbeitet: