Username:Skoddi
geschrieben am 03.02.2004 um 03:11 Uhr
|
hi ,
ich habe ein kleines problem mit der übergabe einer variabelen aus einem hiddenfield.
Hier ersteinmal der code:
datei bestellung.php
<?php require_once('../Connections/werft.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE bestellung SET status=%s, best_id=%s WHERE id=%s",
GetSQLValueString($_POST['status'], "text"),
GetSQLValueString($_POST['bestellcode'], "text"),
GetSQLValueString($_POST['user'], "text"));
mysql_select_db($database_werft, $werft);
$Result1 = mysql_query($updateSQL, $werft) or die(mysql_error());
$updateGoTo = "sendmail.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_werft, $werft);
$query_Recordset1 = "SELECT * FROM bestellung ORDER BY id ASC";
$Recordset1 = mysql_query($query_Recordset1, $werft) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-image: url();
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.Stil1 {color: #CCCCCC}
body,td,th {
color: #CCCCCC;
}
.Stil3 {font-size: small}
.Stil4 {color: #CCCCCC; font-size: small; }
-->
</style>
<link href="hallo.css" rel="stylesheet" type="text/css">
<link href="../hallo.css" rel="stylesheet" type="text/css">
</head>
<body>
<div align="left">
<table width="80%" border="0" align="center" class="Stil4">
<tr>
<td width="90%" height="221" valign="top"><table width="95%" border="1" align="center" bordercolor="#666666" class="Stil4">
<tr>
<td height="19"><p align="center" class="Stil4">..:: <a href="bestellung.php">Bestellungen</a> :: <a href="schiffe.php">Schiffe</a> :: <a href="news.php">news</a> :: <a href="agb.php">agb</a> :: <a href="info.php">info</a> ::..</p> </td>
</tr>
</table>
<?php do { ?>
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<table width="95%" border="0" align="center" bordercolor="#666666">
<tr>
<td height="19"><div align="right">Zeit : </div></td>
<td><?php echo $row_Recordset1['b_zeit']; ?></td>
</tr>
<tr>
<td height="19"><div align="right">Auftraggeber : </div></td>
<td> [ <?php echo $row_Recordset1['alli']; ?>]<?php echo $row_Recordset1['ig_nick']; ?>(<?php echo $row_Recordset1['ek_gala']; ?>x<?php echo $row_Recordset1['ek_sys']; ?>x<?php echo $row_Recordset1['ek_plan']; ?>)</td>
</tr>
<tr>
<td height="19"><div align="right">Bestellung : </div></td>
<td><?php echo $row_Recordset1['bestellung']; ?></td>
</tr>
<tr>
<td height="19"><div align="right">Liefern an : </div></td>
<td><?php echo $row_Recordset1['lk_gala']; ?>x<?php echo $row_Recordset1['lk_sys']; ?>x<?php echo $row_Recordset1['lk_plan']; ?></td>
</tr>
<tr>
<td height="19"><div align="right">Lieferzeit : </div></td>
<td><?php echo $row_Recordset1['l_zeit']; ?></td>
</tr>
<tr>
<td height="19"><div align="right">Status : </div></td>
<td><?php
if($row_Recordset1['status'] == 0)
{
echo "Neu";
}
elseif($row_Recordset1['status'] == 1)
{
echo "Bearbeitung";
}
elseif($row_Recordset1['status'] == 2)
{
echo "Produktion";
}
elseif($row_Recordset1['status'] == 3)
{
echo "Auslieferung";
}?>
<? $row_Recordset1['status'] = $row_Recordset1['status'] + 1; ?>
<input name="status" type="hidden" id="status" value="<?php echo $row_Recordset1['status']; ?>"></td>
</tr>
<tr>
<td height="19" colspan="2"><div align="center">
<input name="bestellcode" type="hidden" id="bestellcode" value="<?php echo $row_Recordset1['best_id']; ?>">
<input name="user" type="hidden" id="user" value="<?php echo $row_Recordset1['id']; ?>">
<input type="submit" name="Submit" value="Update">
</div></td>
</tr>
<tr>
<td height="19" colspan="2"><hr></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
</form>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> <br></td>
</tr>
</table>
<p class="Stil1"> </p>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
hie soll $row_Recordset1['status'] um eins erhöht werden und in die DB eingetragen werden
da funktionirt auch soweit
was nur beim update nicht geschiet , ist, das der wert vom hiddenfild user mit in die datei sendmail.php übergeben wird.
datei sendmail.php
<?php require_once('../Connections/werft.php'); ?>
<?php
$colname_Recordset1 = "1";
if (isset($_POST['user'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_POST['user'] : addslashes($_POST['user']);
}
mysql_select_db($database_werft, $werft);
$query_Recordset1 = sprintf("SELECT * FROM bestellung WHERE id = %s ORDER BY id ASC", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $werft) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-image: url();
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.Stil1 {color: #CCCCCC}
body,td,th {
color: #CCCCCC;
}
.Stil3 {font-size: small}
.Stil4 {color: #CCCCCC; font-size: small; }
-->
</style>
<link href="hallo.css" rel="stylesheet" type="text/css">
<link href="../hallo.css" rel="stylesheet" type="text/css">
</head>
<body>
<div align="left">
<table width="80%" border="0" align="center" class="Stil4">
<tr>
<td width="90%" height="221" valign="top"><table width="95%" border="1" align="center" bordercolor="#666666" class="Stil4">
<tr>
<td height="19"><p align="center" class="Stil4">..:: <a href="bestellung.php">Bestellungen</a> :: <a href="schiffe.php">Schiffe</a> :: <a href="news.php">news</a> :: <a href="agb.php">agb</a> :: <a href="info.php">info</a> ::..</p> </td>
</tr>
</table>
<br>
<table width="95%" border="1" align="center" bordercolor="#666666">
<tr>
<td><div align="left">
<blockquote>
<p align="center">Bestellung mit ID <?php echo $row_Recordset1['id']; ?>
geändert <br>
Status ist jetzt <?php
if($row_Recordset1['status'] == 0)
{
echo "Neu";
}
elseif($row_Recordset1['status'] == 1)
{
echo "Bearbeitung";
}
elseif($row_Recordset1['status'] == 2)
{
echo "Produktion";
}
elseif($row_Recordset1['status'] == 3)
{
echo "Auslieferung";
}?>
. <?
$texta = "Hallo , Deine Bestellung ist jetzt in Bearbeitung.";
$textb = "Hallo , Deine Bestellten Schiffe sind gerade in Produktion gegangen.";
$textc = "Hallo , Deine Bestellten Schiffe befinden sich im Anflug auf deinen Planeten.";
$betreff = "Deine Bestellung";
if($row_Recordset1['status'] == "1")
{
mail($row_Recordset1['e_mail'], $betreff, $texta, "From: Lord Lucky <lord-lucky@vortex-xw.de>");
}
elseif($row_Recordset1['status'] == "2")
{
mail($row_Recordset1['e_mail'], $betreff, $textb, "From: Lord Lucky <lord-lucky@vortex-xw.de>");
}
elseif($row_Recordset1['status'] == "3")
{
mail($row_Recordset1['e_mail'], $betreff, $textc, "From: Lord Lucky <lord-lucky@vortex-xw.de>");
}
?>
</p>
<p align="center"> </p>
</blockquote>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<p class="Stil1"> </p>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
wäre super wenn einer dafür eine lösung wüsste
mfg Skoddi |