I am trying to insert html
Tag attributes value in mysql as below
<div class="col-sm-6">
<p id="idd"></p><br>
<p id="path" class="d-none" ></p>
<label>Name</label><br>
<input type="text" id="name" name="name" style="width:300px;"><br><br>
<label>Mobile</label><br>
<input type="text" id="mobil" name="mobil" style="width:150px;"><br><br>
<label>Email</label><br>
<input type="text" id="email" name="email" style="width:200px;"><br><br>
<label>Enter Qty</label><br>
<input type="text" id="qty" name="qty" style="width:70px;" ><br><br>
<label style="display:inline">Price:</label >
<p id="price" style="display:inline"></p><br><br>
<label>Total Amount</label><br>
<input type="text" id="tamt" name="tamt" style="width:150px;" disabled><br><br>
<input type="submit" id="btn" name="btn" text="Submit">
</div>
php File is
1 <?php
2 $servername = "localhost";
3 $username = "myuser";
4 $password = "mypwd";
5 $dbname = "mydb";
6
7 try {
8 $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username,
9 $password);
10
11 $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
12
13
14 $stmt = $conn->prepare("INSERT INTO myorder ( name, path, mobil, email, qty, price, tamt, myidd)VALUES(:name, :path, :mobil, :email, :qty, :price, :tamt, :myidd)");
15
16
17 $stmt->bindParam(':name', $name);
18 $stmt->bindParam(':path', $path);
19 $stmt->bindParam(':mobil', $mobil);
20 $stmt->bindParam(':email', $email);
21 $stmt->bindParam(':qty', $qty);
22 $stmt->bindParam(':price', $price);
23 $stmt->bindParam(':tamt', $tamt);
24 $stmt->bindParam(':myidd', $idd);
25
26
27 $name = $_POST['name'];
28 $path = $_POST['path'];
29 $mobil = $_POST['mobil'];
30 $email = $_POST['email'];
31 $qty = $_POST['qty'];
32 $price = $_POST['price'];
33 $tamt = $_POST['tamt'];
34 $idd = $_POST['idd'];
35 $stmt->execute();
36 echo "New records saved successfully";
37 }
38 catch(PDOException $e)
39 {
40 echo "Error: " . $e->getMessage();
41 }
42
43 $conn = null;
44
45 ?>
input tag value are inserted into mysql table successfully but "p" tag not inserted but its shows below Error
Notice: Undefined index: path in /home/brandstu/public_html/php/order.php on line 28
Notice: Undefined index: price in /home/brandstu/public_html/php/order.php on line 32
Notice: Undefined index: tamt in /home/brandstu/public_html/php/order.php on line 33
Notice: Undefined index: idd in /home/brandstu/public_html/php/order.php on line 34
New records saved successfully
I try but don't know how to do?.
What I have tried:
invested whole day on online. search online regarding the topics but not found solution.