I can't find the misstake in the following code. I have a html Table with the fixed values item und price and calculated value total and the input value quantity
the calculation.js works fine as well as the connection to the database. it just cant find the array keys and tells me this if i click the button
Warning: Undefined array key "username" in C:\xampp\htdocs\Kulinarik\order_save.php on line 7
Warning: Undefined array key "item" in C:\xampp\htdocs\Kulinarik\order_save.php on line 8
Warning: Undefined array key "quantity" in C:\xampp\htdocs\Kulinarik\order_save.php on line 9
this is the code
html
<form method="POST" action="order_save.php">
<table class="u-table-entity" src="jquery.js">
<script scr="calculation.js"></script>
<colgroup>
<col width="20%">
<col width="2.1%">
<col width="22%">
<col width="21.7%">
<col width="34.2%">
</colgroup>
<tbody class="u-table-alt-grey-5 u-table-body">
<tr style="height: 55px;">
<b>
<th class="u-table-cell u-table-cell-1"><b>Produkt</b><span style="font-weight: 700;"></span>
</th>
<th class="u-table-cell"></th>
<th class="u-table-cell u-table-cell-3"><b>Einzelpreis</b></th>
<th class="u-table-cell u-table-cell-4"><b>Menge</b></th>
<th class="u-table-cell u-table-cell-5"><b>Gesamtpreis</b></th>
</b>
</tr>
<tr style="height: 55px;">
<td class="u-table-cell">
<input type="text" class="item" value="Kornspitz" name="item" placeholder="Kornspitz" readonly />
</td>
<td class="u-table-cell"></td>
<td class="u-table-cell">
<input type="text" class="price" value="1.39" name="price" readonly/>
</td>
<td class="u-table-cell">
<input type="text" class="quantity" name="quantity"/>
</td>
<td class="u-table-cell">
<input type="text" class="total" name="total" readonly/>
</td>
</tr>
<tr style="height: 55px;">
<td class="u-table-cell"></td>
<td class="u-table-cell"></td>
<td class="u-table-cell"></td>
<td class="u-table-cell u-table-cell-19"> Gesamtpreis:</td>
<td class="u-table-cell"></td>
</tr>
<tr style="height: 56px;">
<td class="u-table-cell"></td>
<td class="u-table-cell"></td>
<td class="u-table-cell"></td>
<td class="u-table-cell u-table-cell-24"> <a class="u-active-none u-border-none u-btn u-button-link u-button-style u-hover-none u-none u-text-custom-color-1 u-text-hover-custom-color-2 u-btn-1" href="https://nicepage.com">AGB</a>
</td>
<td class="u-table-cell u-table-cell-25">
<a class="u-border-none u-btn u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-2" type="submit" href="order_save.php">BESTELLUNG</a>
</td>
</tr>
</tbody>
</table>
</form>
php
<?php
session_start();
?>
<?php
$con= mysqli_connect('localhost','root','123456');
mysqli_select_db($con, 'orders');
$username = $_SESSION['username'];
$item = $_POST['item'];
$quantity = $_POST['quantity'];
?>
the username i want to add is from the session_login maybe there is a way to add this too ? it is created with this code
<?php
session_start();
?>
<?php
$ldap_dn = "uid=".$_POST["username"].",dc=example,dc=com";
$ldap_password = $_POST["password"];
$ldap_con = ldap_connect("ldap.forumsys.com");
ldap_set_option($ldap_con, LDAP_OPT_PROTOCOL_VERSION, 3);
if(@ldap_bind($ldap_con,$ldap_dn,$ldap_password))
{
$_SESSION['username'] = $_POST["username"];
header("Location: Startseite.php");
}
else
{
echo "Invalid Credential";
}
?>
I would really appreciate your help thanks