This commit is contained in:
FlyInTheBox 2023-11-19 17:04:22 +01:00
parent f5d1da0aa0
commit 65ffed3779
2 changed files with 43 additions and 19 deletions

View file

@ -1,16 +1,14 @@
<select id="Departament" name="dept"> <?php $mid = '';
<?php $dept = ''; $w_mid = mysqli_fetch_array($wyn_mid);
$w_dept = mysqli_fetch_array($wyn_dept); $midle = $w_mid['name'];
$deptle = $w_dept['name']; ?>
?> <option value=<?php printf("%s", "'" . $midle . "'"); ?> selected><?php printf("%s", $midle); ?></option>
<option value=<?php printf("%s", "'" . $deptle . "'"); ?> selected><?php printf("%s", $deptle); ?></option> <?php
<?php while ($w_mid = mysqli_fetch_array($wyn_mid))
while ($w_dept = mysqli_fetch_array($wyn_dept)) {
{ $midle = $w_mid['name'];
$deptle = $w_dept['name']; ?>
?> <option value=<?php printf("%s", "'" . $midle . "'"); ?>><?php printf("%s", $midle); ?></option>
<option value=<?php printf("%s", "'" . $deptle . "'"); ?>><?php printf("%s", $deptle); ?></option> <?php
<?php }
} ?>
?>
</select>

View file

@ -38,6 +38,15 @@
mysqli_close($id_conn); mysqli_close($id_conn);
exit; exit;
} }
$sql_mid = "SELECT szef.id, szef.last_name FROM emp AS szef INNER JOIN emp AS prac ON szef.id = prac.manager_id;";
$wyn_mid = mysqli_query($id_conn, $sql_mid);
if (mysqli_errno($id_conn))
{
echo "Błąd w zapytania o managera: " . $baza . ' (' . mysqli_error($id_conn) . ')';
mysqli_close($id_conn);
exit;
}
?> ?>
@ -70,7 +79,7 @@
<select id="Departament" name="dept_id"> <select id="Departament" name="dept_id">
<?php $dept = ''; <?php $dept = '';
$w_dept = mysqli_fetch_array($wyn_dept); $w_dept = mysqli_fetch_array($wyn_dept);
$deptle = $w_dept['id'] + '|' + $w_dept['name'] + '|' + $w_dept['region']; $deptle = $w_dept['id'] . '|' . $w_dept['name'] . '|' . $w_dept['region'];
?> ?>
<option value=<?php printf("%s", "'" . $deptle . "'"); ?> selected><?php printf("%s", $deptle); ?></option> <option value=<?php printf("%s", "'" . $deptle . "'"); ?> selected><?php printf("%s", $deptle); ?></option>
<?php <?php
@ -84,8 +93,25 @@
?> ?>
</select></td></tr> </select></td></tr>
<tr><td>Zarobki: </td><td><input type='text' name='salary' ></td></tr> <tr><td>Zarobki: </td><td><input type='text' name='salary' ></td></tr>
<tr><td>Data: </td><td><input type='text' name='start_dt' ></td></tr> <tr><td>Data: </td><td><input type='date' name='start_dt' ></td></tr>
<tr><td>ID managera:</td><td><input type='text' name='man_id' ></td></tr> <tr><td>ID managera:</td><td><select id="Manager" name="man_id">
<?php $mid = '';
$w_mid = mysqli_fetch_array($wyn_mid);
$midle = $w_mid['id'];
$midle .= ' | ' . $w_mid['last_name'];
?>
<option value=<?php printf("%s", "'" . $midle . "'"); ?> selected><?php printf("%s", $midle); ?></option>
<?php
while ($w_mid = mysqli_fetch_array($wyn_mid))
{
$midle = $w_mid['name'];
$midle .= ' | ' . $w_mid['last_name'];
?>
<option value=<?php printf("%s", "'" . $midle . "'"); ?>><?php printf("%s", $midle); ?></option>
<?php
}
?>
</select> </tr>
<tr><td>Uwagi: </td><td><input type='text' name='uwagi' ></td></tr> <tr><td>Uwagi: </td><td><input type='text' name='uwagi' ></td></tr>
<tr><td><p><input type='submit' value='Wyślij'></td></tr> <tr><td><p><input type='submit' value='Wyślij'></td></tr>
</form> </form>