
Originally Posted by
djr33
Yes, I did... cut and paste error. Fixed now. Thanks.
Hi
well I just do not write anything. It's not necessary, really.
I have another form where I want to delete the content of the onput on upload. So there I put every single variable on empty string, but not in the same function, but after reading out DB Content. So it cannot be sent twice.
I have an existing script which I change for my needs.
Is it correct, in the below script I could delete the first 3 lines ?
LG J.
PHP Code:
<?PHP
/*1*/ if (!isset($_POST['form_datum'])) $_POST['form_datum'] = '';
/*2*/ if (!isset($_POST['form_email'])) $_POST['form_email'] = '';
/*3*/ if (!isset($_POST['form_text'])) $_POST['form_text'] = '';
/*4*/ if (!isset($status)) $status = '';
if (isset($_POST['upload'])) {
if (isset($_POST['form_datum']) && ($_POST['form_email']) && ($_POST['form_text']))
{
$sql = "INSERT INTO gaestebuch (datum, email, text) VALUES (
'".$_POST['form_datum']."',
'".$_POST['form_email']."',
'".$_POST['form_text']."'
)";
$result = mysql_query($sql);
if($result) {
$status = "...eingetragen";
}
else {
$status = "...fehlgeschlagen '".mysql_error()."'";
}
}
else {
$status = '...Fehler! Fehlende Daten ';
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="de">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="Robots" content="INDEX,FOLLOW">
<meta name="Revisit" content="After 30 days">
<link href="scripts/....css" rel="stylesheet" type="text/css">
<script type="text/JavaScript">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="/scripts/jquery.ez-bg-resize.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("body").ezBgResize({
img : "/grafik/hintergrund_gaestebuch.gif", // Relative path example. You could also use an absolute url ([url]http://.[/url]..).
opacity : 1, // Opacity. 1 = 100%. This is optional.
center : true // Boolean (true or false). This is optional. Default is true.
});
});
</script>
</head>
<body >
<div id="main">
<div id="logo"><img src="grafik/anna_logo.gif" alt="" border="0" width="212" height="45"></div>
<div align="left" id="navi">
<a href="index.php"> home</a>
<a href="biografie.php">biografie</a>
<a href="musik.php">musik</a>
<a href="videos.php">videos</a>
<a href="galerie.php">galerie</a>
<a href="gaestebuch.php">gästebuch</a>
<a href="pressetext.php">pressetext</a>
<a href="kontakt.php">kontakt</a>
</div>
<div id="gaestebuch">
<h1 id="inhtitel">Gästebuch</h1>
<div id="gtexte"><?PHP
$i = "0";
$sql = "SELECT datum, email, text FROM gaestebuch ORDER BY id DESC";
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
$i++;
if($i%2 == 0) {echo '<tr>';}
else {echo '<tr>';}
echo '<td width="30%" align="left">'.$row['datum'].'<br/></td></tr>';
echo '<tr><td width="70%" align="left">'.$row['text'].'. '.$row['email'].'<br/></td>';
echo '</tr>';
}
$_POST['form_datum'] = '';
$_POST['form_email'] = '';
$_POST['form_text'] = '';
?>
</div>
<div id="guestin" > <hr> <form action="<?= $_SERVER['REQUEST_URI'] ?>" method="post" enctype="multipart/form-data" name="gaestebuch">
Datum:
<input name="form_datum" type="text" id="form_datum" size="15" maxlength="20" value="<?= $_POST['form_datum'] ?>">
Name: <input name="form_email" type="text" id="form_email" size="30" maxlength="40" value="<?= $_POST['form_email'] ?>">
<br>
Dein Text:<br /><textarea name="form_text" cols="53" rows="3" id="form_text"> <?= $_POST['form_text'] ?></textarea>
<input type="submit" name="upload" value="Upload">
</form> </div>
Bookmarks