On my page I have top, left side,right side , footer containers. The top shows time date etc,the left side shows existing data from mysql, the footer has form which I output data to the right side.
I am making a new project ( making quotations), the left side would show in a table all quotes to a specific client.
I would input at the footer which will creates table on the right side.
Currently footer has one field ,name of customer which it correctly displays on the footer, which when accepted should show on the right side, clear the footer field and offer another form which after acceptance should clear the footer field and so on until the table is populated.
In my instance the 1st step ie name field display the name correctly but the name form does not clear but stays and adds the next form. How do I remove the name form, display name on right side and offer the next form?
<?php
setlocale(LC_MONETARY, 'en_IN');
date_default_timezone_set('Asia/Kolkata');
include "config.php"
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="container">
<div class="parent">
<?php include "head.php"; ?>
<aside class="section leftSidebar">
<?php include "left.php"; ?>
</aside>
<main class="section main">
<table class="tg">
<colgroup>
<col style="width: 120px" />
<col style="width: 90px" />
<col style="width: 100px" />
<col style="width: 100px" />
<col style="width: 200px" />
<col style="width: 120px" />
<col style="width: 90px" />
</colgroup>
<thead>
Quotations
</thead>
<tbody>
<tr>
<td class="tg-h2xt">Contact</td>
<td class="tg-h2xt">Phone </td>
<td class="tg-h2xt">Quote No</td>
<td class="tg-h2xt">Date</td>
<td class="tg-h2xt">Details</td>
<td class="tg-h2xt">Amount</td>
<td class="tg-h2xt">Status</td>
</tr>
<tr>
<?php
$sql = "SELECT * FROM quote";
$result_data=mysqli_query($conn, $sql);
while ($row_data = mysqli_fetch_assoc($result_data)) {
$q_no=$row_data['q_no'];
$q_date=$row_data['q_date'];
$customer=$row_data['q_code'];
echo "<td class='tg-0pky' ><form class='new' action= '' method='POST'>
<input type='hidden' name='id' value=" .$row_data['q_id']. ">
<input type='submit' class='cancelbtn1' name='delete' value='DELETE''></form></td>";
if(isset($_POST['id'])) {
$id=$_REQUEST['id'];
$query = "DELETE FROM quote WHERE q_id=$id" ;
$result = mysqli_query($conn,$query);
header("Location: quote.php");
}
echo "</td>";
echo "</tr>";
}
echo "<td class='tg-zvt6'></td>";
echo "<td class='tg-zvt6'></td>";echo "<td class='tg-zvt6'></td>";echo "<td class='tg-zvt6'></td>";
echo "<td class='tg-zvt6'></td>";
echo "<td class='tg-zvt6'>" .number_format($sum,2). "</td>";
echo "<td class='tg-zvt6' colspan= '2'></td>";
if(isset($_POST['customer'])){
echo $cust_name;
}
?>
</tbody>
</table>
</main>
<aside class="section rightSidebar">
<table class="tg">
<?php
if(isset($cust_name)){
echo "<tr>";
echo "<td class='tg-h2xt220'>" .$cust_name ."</td>";
}
?>
<td class="tg-h2xt80">No. </td>
<td class="tg-h2xt120">Item Code </td>
<td class="tg-h2xt220">Particulars</td>
<td class="tg-h2xt120">Rate</td>
<td class="tg-h2xt80">Qty </td>
<td class="tg-h2xt120">Amount</td>
</tr>
<td colspan="6" style= text-align:left;>Sub - Head:</td>
<tr>
<td class="tg-h2xt80">$1.
<td class="tg-h2xt120">$code
<td class="tg-h2xt220">$part
<td class="tg-h2xt80">$rate
<td class="tg-h2xt80">$qty
<td class="tg-h2xt120">$amount
</td>
</table>
<table>
<colgroup>
<col style="width: 300px" />
<col style="width: 180px" />
<col style="width: 160px" />
<col style="width: 150px" />
<col style="width: 90px" />
<col style="width: 90px" />
</colgroup>
<td class="tg-n7df-cl">
<td class="tg-n7df-cl">
<td class="tg-n7df">Total
<td class="tg-n7df">10000000.00
<tr>
<td class="tg-n7df-cl">
<td class="tg-n7df-cl">
<td class="tg-n7df"><label for="gst">GST%:</label><input type="text" placeholder='18%' name="gst" maxlength="6" size="4"/>
<td class="tg-n7df">10,000.00</td>
</br>
</tr>
<td class="tg-n7df-cl">
<td class="tg-n7df-cl">
<td class="tg-n7df">Grand Total
<td class="tg-n7df">10000000.00
</tr>
</table>
<br>
Note: <input type="text" name="note" maxlength="60" size="60"/>
<br>
Terms & Conditions:
<br>
By:<input type="text" name="salesman" placeholder='Name' />
</aside>
</form>
<footer class="section footer ">
<form name="quote" action=" " method="POST">
Customer:
<?php
if(!isset($cust_name)){
$query="SELECT * FROM user_details WHERE u_type='Customer'";
$result = mysqli_query($conn, $query) or die ('Unable to execute'.mysqli_error($conn));
echo "<select name='customer'>";
echo "<option value='New'>New User</option>";
while ($row = mysqli_fetch_assoc($result)) {
echo "<option value=".$row['u_id'].">".$row['org']."</option>";
}
echo "</select>";
$cust_name=$_POST['customer'];
$query="SELECT * FROM user_details WHERE u_id='$cust_name'";
$result = mysqli_query($conn, $query) or die ('Unable to execute'.mysqli_error($conn));
while ($row = mysqli_fetch_assoc($result)) {
$cust_name= $row['contact'] .',M/s.'. $row['org'] .','. $row['addr'] .','. $row['city'] .','. $row['pincode'];
}
echo "<input class='blue' type=submit name='next' value='Next >>' />";
echo "<input class='red' type=reset name='Reset' value='Reset' />";
echo "</form>";
header("location: test.php");
}
if(isset($cust_name)){
echo "inserted";
?>
Date:<input type="date" name="q_date" />
Ref:<input type="test" name="q_ref" maxlength="8" size="4">
Quotation No: <input type="text" id='customer' name="customer" />
Customer Ref:<input type="text" id='customer' name="customer" />
Customer Date:<input type="date" name="q_date" />
<input class='blue' type=submit name="next" value="Next >>" />
<input class='red' type=reset name="Reset" value="Reset" />
<?php
}
?>
</form>
</footer>
</div>
</div>
</body>
</html>