He hatte letzte Woche schon mal gepostet, bin aber noch nicht weiter. Ich habe folgendes Formular, wo ich Daten eingebe, und dann auswählen kann auf welcher Web-Site die Daten angezeigt werden. Meine Tabelle in der Mysql Datenbank für site1, site2, site3 hat den wert integer.
</head>
<body bgcolor="#FFFFFF" background="hell.jpg">
<table width="68%" border="0">
<tr>
<td width="38%">
<div align="right">Name</div>
</td>
<td colspan="3">
<input type="text" name="name" size="45">
</td>
</tr>
<tr>
<td width="38%">
<div align="right">Vorname</div>
</td>
<td colspan="3">
<input type="text" name="vorname" size="45">
</td>
</tr>
<tr>
<td width="38%" height="22">
<div align="right">darstellen in</div>
</td>
<td width="17%" height="22">
<input type="checkbox" name="checkbox" value="checkbox">
site1 </td>
<td width="21%" height="22">
<input type="checkbox" name="checkbox2" value="checkbox">
site2 </td>
<td width="24%" height="22">
<input type="checkbox" name="checkbox3" value="checkbox">
site3 </td>
</tr>
<tr>
<td width="38%"> </td>
<td colspan="3">
<form name="form1" method="post" action="kontrolle.php">
<input type="submit" style="FONT-WEIGHT: bold;cursor:hand; HEIGHT: 26px; WIDTH: 151px" name="Eintragen" value="Eintragen">
<input type="reset" style="FONT-WEIGHT: bold;cursor:hand; HEIGHT: 26px; WIDTH: 151px" name="Abbrechen" value="Abbrechen ">
</form>
</td>
</tr>
</table>
</body>
</html>
was muss ich ergänzen, damit die checkboxen akzeptiert werden.
</head>
<body bgcolor="#FFFFFF" background="hell.jpg">
<table width="68%" border="0">
<tr>
<td width="38%">
<div align="right">Name</div>
</td>
<td colspan="3">
<input type="text" name="name" size="45">
</td>
</tr>
<tr>
<td width="38%">
<div align="right">Vorname</div>
</td>
<td colspan="3">
<input type="text" name="vorname" size="45">
</td>
</tr>
<tr>
<td width="38%" height="22">
<div align="right">darstellen in</div>
</td>
<td width="17%" height="22">
<input type="checkbox" name="checkbox" value="checkbox">
site1 </td>
<td width="21%" height="22">
<input type="checkbox" name="checkbox2" value="checkbox">
site2 </td>
<td width="24%" height="22">
<input type="checkbox" name="checkbox3" value="checkbox">
site3 </td>
</tr>
<tr>
<td width="38%"> </td>
<td colspan="3">
<form name="form1" method="post" action="kontrolle.php">
<input type="submit" style="FONT-WEIGHT: bold;cursor:hand; HEIGHT: 26px; WIDTH: 151px" name="Eintragen" value="Eintragen">
<input type="reset" style="FONT-WEIGHT: bold;cursor:hand; HEIGHT: 26px; WIDTH: 151px" name="Abbrechen" value="Abbrechen ">
</form>
</td>
</tr>
</table>
</body>
</html>
PHP-Code:
<?php
$variable = $HTTP_POST_VARS['name'];
$variable1 = $HTTP_POST_VARS['vorname'];
$variable2 = $HTTP_POST_VARS['site1'];
$variable3 = $HTTP_POST_VARS['site2'];
$variable4 = $HTTP_POST_VARS['site3'];
mysql_connect("Grafik","root","");
mysql_select_db("veranstaltungen");
mysql_query("INSERT INTO daten(name, vorname, site1, site2, site3) VALUES('$variable','$variable1'
,'$variable2','$variable3','$variable4')");
mysql_close();
?>
was muss ich ergänzen, damit die checkboxen akzeptiert werden.
Kommentar