Seite 1 von 1

Zu ändernde Tabelle per Dropdown Menü auswählen ??

Verfasst: 08.05.2004 13:16
von siebenschlaefer
Ich habe vor ein formular auf meine seite zu stellen bei welchem 7 verschiedene leute ihre termine eintragen können, welche dann später auf einer seite angezeigt werden, so bleibt mir das ständige updaten erspart und jeder kann seine termine selbst eintragen.

Nun habe ich 7 Tabellen angelegt - für jeden user eine, und in jeder tabelle befinden sich 3 reihen: datum, was, wo

Meine frage ist nun wie ich bei dem eintragsformular ein dropdown menü nutze in dem dann die 7 user aufgelistet sind, damit der user sozusagen sich auswählt und damit das formluar weiß in welche tabelle der die eingetragenen daten schreiben soll.

Hier mein formular:
<?php require_once('Connections/ostcoderockerz_de.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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO 2face (datum, party, location) VALUES (%s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['datum'], "text"),
GetSQLValueString($HTTP_POST_VARS['party'], "text"),
GetSQLValueString($HTTP_POST_VARS['location'], "text"));

mysql_select_db($database_ostcoderockerz_de, $ostcoderockerz_de);
$Result1 = mysql_query($insertSQL, $ostcoderockerz_de) or die(mysql_error());
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="layout.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="D7D3B1" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="background-image:url(pix/bg_main.gif); background-repeat:no-repeat; background-attachment:fixed;" class="main">
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table class="main">
<tr valign="baseline">
<td nowrap>Datum:</td>
<td><input type="text" name="datum" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap>Party:</td>
<td><input type="text" name="party" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap>Location:</td>
<td><input type="text" name="location" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" value="Datensatz einfügen"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>

</body>
</html>
wär ne feine sache wenn mir jemand helfen könnte

Verfasst: 09.05.2004 13:44
von siebenschlaefer
hat da wirklich niemand ne idee ?! :roll:

Verfasst: 09.05.2004 14:28
von Jack9027

Code: Alles auswählen

            <td>
              <select name="cuser">
                <option style="color: #303030" value="#303030" selected>#303030</option>
                <option style="color: #EBEBEB" value="#EBEBEB">#EBEBEB</option>
                <option style="color: #606060" value="#606060">#606060</option>
                <option style="color: #909090" value="#909090">#909090</option>
                <option style="color: #FF0000" value="#FF0000">#FF0000</option>
                <option style="color: #880000" value="#880000">#880000</option>
                <option style="color: #FF8888" value="#FF8888">#FF8888</option>
                <option style="color: #00BB00" value="#00BB00">#00BB00</option>
                <option style="color: #004400" value="#004400">#004400</option>
                <option style="color: #44FF44" value="#44FF44">#44FF44</option>
                <option style="color: #4444FF" value="#4444FF">#4444FF</option>
                <option style="color: #0000AA" value="#0000AA">#0000AA</option>
                <option style="color: #AAAAFF" value="#AAAAFF">#AAAAFF</option>
                <option style="color: #FFA000" value="#FFA000">#FFA000</option>
                <option style="color: #FF00FF" value="#FF00FF">#FF00FF</option>
                <option style="color: #A000A0" value="#A000A0">#A000A0</option>
                <option style="color: #606000" value="#606000">#606000</option>
                <option style="color: #A0A000" value="#A0A000">#A0A000</option>
              </select>
            </td>
musst halt noch so abändern wie du des brauchst

Re: Zu ändernde Tabelle per Dropdown Menü auswählen ??

Verfasst: 09.05.2004 15:02
von Pyramide
siebenschlaefer hat geschrieben:Nun habe ich 7 Tabellen angelegt - für jeden user eine
Warum nimmst du nicht eine Tabelle und fügst ein Feld ein, in dem steht zu welchem user der Eintrag gehört?

Verfasst: 09.05.2004 16:01
von siebenschlaefer
vielen dank @ jack aber wie ich nen dropdown mache weiß ich auch allein :lol: ...mir gehts um die datenbankanbindung, so dass ich aus dem dropdown einen user auswähle und somit das unter dem dropdown stehende formular weiß in welche tabelle es die eingetragenen daten senden soll

@ pyramide :roll:

Verfasst: 29.11.2007 22:14
von phillip
gibts nicht ein Jumpdropdown der Foren?

dies sollte auch irgendwo in den includes sein... ich glaub sogar in der function.php