<option>$row[0]</option> Probleem
hij versuurt de compid niet naar de insert into
hoe kan dat??
<html><body background="img/rj45.jpg" vlink="#FFFFFF" alink="#FFFFFF">
<div align="center">
<table border="0" cellpadding="2" cellspacing="4" style="border-collapse: collapse" bordercolor="#111111" width="550" height="366">
<tr>
<td width="550" height="43" colspan="2">
<p align="center"><b><font size="4" face="Verdana" color="#FFFFFF">Klantendatabase</font></b></td>
</tr>
<tr>
<td width="150" height="20"><font face="Verdana" size="2" color="#FFFFFF"><a href="inloggen.php" target="_self">inloggen</a></font></td>
<td width="380" height="319" rowspan="7">
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?
require "connect.php";
$datumin = date("d.m.Y");
$datumuit = date("d.m.Y");
if ($_POST['merk'] && $_POST['type'] && $_POST['oms'] && $_POST['sn'])
{
$sql = "INSERT INTO kcomponent (compid, merk, type, oms, sn, datumin, datumuit, hsid) VALUES ('$compid', '$merk', '$type', '$oms', '$sn', '$datumin', '$datumuit', '$hsid')";
$res = mysql_query($sql)or die (mysql_error());
if ($res)
{
echo "gegevens zijn verwerkt<p>";
echo "Ga naar <a href=\"overzichtonderdelen.php\">volgende</a>.";
}
else
{
echo "Sorry niet aangemeld. Er is iets misgegaan met het invoeren in de database.";
echo "<a href=\"inhoud.php\">Probeer het nog eens</a>";
}
}
else
{
if ($_POST["submit"])
echo "Enkele velden vergeten!";
echo "<div align='center'>";
echo "<center>";
echo "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='380' height='169'>";
echo "<tr><td width='380' height='117' align='center' colspan='2'><font color='#FFFFFF' size='4'face='verdana'>Nieuwe hardwarecomponent<br>toevoegen</font></td></tr>";
echo "<tr><td>";
echo "<form method='POST' action='$php_self'><select size='1' name='onderdelen'>";
$sql = "SELECT * FROM comp_oms_id";
$res1 = mysql_query($sql)or die(mysql_error());
if (mysql_num_rows($res1) >= 1 )
{
while
($row = mysql_fetch_row($res1))
{
echo '<option value="'.$_POST['compid'].'">'.$row[1].'</option>';
}
}
echo "</select>";
echo "$hsid</td></tr>";
echo "<tr><td width='190' height='25'align='right'><font face='Verdana' color='#FFFFFF'>Merk:</font></td>";
echo "<td width='190' height='15'><input type='text' style='border-style: dashed; border-width: 0' maxlength='20' size='20' name='merk' value='$_POST[merk]'></td></tr>";
echo "<tr><td width='190' height='15' align='right'><font face='Verdana' color='#FFFFFF'>Type:</font></td>";
echo "<td width='190' height='15'><input type='text' style='border-style: dashed; border-width: 0' maxlength='20' size='20'name='type' value='$_POST[type]'></td></tr>";
echo "<tr><td width='190' height='15' align='right'><font face='Verdana' color='#FFFFFF'>Omschrijving:</font></td>";
echo "<td width='190' height='15'><input type='text' style='border-style: dashed; border-width: 0' maxlength='255' size='20'name='oms' value='$_POST[oms]'></td></tr>";
echo "<tr><td width='190' height='15' align='right'><font face='Verdana' color='#FFFFFF'>Serial nummer:</font></td>";
echo "<td width='190' height='15'><input type='text' style='border-style: dashed; border-width: 0' maxlength='7' size='7' name='sn' value='$_POST[sn]'></td></tr>";
echo "<tr><td width='380' height='15' colspan='2'>";
echo "<input type='submit' value='Verzenden' name='submit'></td></tr>";
echo "</form></table>";
echo "</center>";
echo "</div>";
}
?>
require "connect.php";
$datumin = date("d.m.Y");
$datumuit = date("d.m.Y");
if ($_POST['merk'] && $_POST['type'] && $_POST['oms'] && $_POST['sn'])
{
$sql = "INSERT INTO kcomponent (compid, merk, type, oms, sn, datumin, datumuit, hsid) VALUES ('$compid', '$merk', '$type', '$oms', '$sn', '$datumin', '$datumuit', '$hsid')";
$res = mysql_query($sql)or die (mysql_error());
if ($res)
{
echo "gegevens zijn verwerkt<p>";
echo "Ga naar <a href=\"overzichtonderdelen.php\">volgende</a>.";
}
else
{
echo "Sorry niet aangemeld. Er is iets misgegaan met het invoeren in de database.";
echo "<a href=\"inhoud.php\">Probeer het nog eens</a>";
}
}
else
{
if ($_POST["submit"])
echo "Enkele velden vergeten!";
echo "<div align='center'>";
echo "<center>";
echo "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='380' height='169'>";
echo "<tr><td width='380' height='117' align='center' colspan='2'><font color='#FFFFFF' size='4'face='verdana'>Nieuwe hardwarecomponent<br>toevoegen</font></td></tr>";
echo "<tr><td>";
echo "<form method='POST' action='$php_self'><select size='1' name='onderdelen'>";
$sql = "SELECT * FROM comp_oms_id";
$res1 = mysql_query($sql)or die(mysql_error());
if (mysql_num_rows($res1) >= 1 )
{
while
($row = mysql_fetch_row($res1))
{
echo '<option value="'.$_POST['compid'].'">'.$row[1].'</option>';
}
}
echo "</select>";
echo "$hsid</td></tr>";
echo "<tr><td width='190' height='25'align='right'><font face='Verdana' color='#FFFFFF'>Merk:</font></td>";
echo "<td width='190' height='15'><input type='text' style='border-style: dashed; border-width: 0' maxlength='20' size='20' name='merk' value='$_POST[merk]'></td></tr>";
echo "<tr><td width='190' height='15' align='right'><font face='Verdana' color='#FFFFFF'>Type:</font></td>";
echo "<td width='190' height='15'><input type='text' style='border-style: dashed; border-width: 0' maxlength='20' size='20'name='type' value='$_POST[type]'></td></tr>";
echo "<tr><td width='190' height='15' align='right'><font face='Verdana' color='#FFFFFF'>Omschrijving:</font></td>";
echo "<td width='190' height='15'><input type='text' style='border-style: dashed; border-width: 0' maxlength='255' size='20'name='oms' value='$_POST[oms]'></td></tr>";
echo "<tr><td width='190' height='15' align='right'><font face='Verdana' color='#FFFFFF'>Serial nummer:</font></td>";
echo "<td width='190' height='15'><input type='text' style='border-style: dashed; border-width: 0' maxlength='7' size='7' name='sn' value='$_POST[sn]'></td></tr>";
echo "<tr><td width='380' height='15' colspan='2'>";
echo "<input type='submit' value='Verzenden' name='submit'></td></tr>";
echo "</form></table>";
echo "</center>";
echo "</div>";
}
?>
</td>
</tr>
<tr>
<td width="150" height="20"><font face="Verdana" size="2"><a style='color: #FFFFFF' href="overzichtklanten.php" target="_self">klanten
overzicht</a></font></td>
</tr>
<tr>
<td width="150" height="20"><font face="Verdana" size="2">zoek</font></td>
</tr>
<tr>
<td width="150" height="20"><font face="Verdana" size="2">etc</font></td>
</tr>
<tr>
<td width="150" height="20"><font face="Verdana" size="2"><a style='color: #FFFFFF' href="invulklanten.php" target="_self">nieuwe<br>klanten<br>invoer.</a></font></td>
</tr>
<tr>
<td width="150" height="20"><font face="Verdana" size="2"><a style='color: #FFFFFF' href="index.php" target="_self">home</a></font></td>
</tr>
<tr>
<td width="150" height="190"> <td>
</tr>
</table>
</div></body></html>
Code (php)
waar begin je de <select> die staat er niet in
echo "<form method='POST' action='$php_self'><select size='1' name='onderdelen'>";