Jump to content

Fetch the data from databse and display in table based on the month selection


Go to solution Solved by Senthilkumar,

Recommended Posts

Dear team,

I am having two tables. One is to set the target values month wise and another one is to update the actual value agains the target month wise (display the target value).

Once i set the target value, it is inserting the databse properly. My databse is 

 

 

image.thumb.png.e2c798408b719f0294eaf4195ceea459.png

My another page whis is using to update the actual values is looks like this

image.thumb.png.da09fea9431045153fccfd5278d2d1fd.png

In above picture, once i select the month, the target value should display automatically on desctiption inrow and category in column. 

My table code is

<form method="POST" action="" onsubmit="return confirm('Are you sure you want to submit?');">
					<div style="display: inline-block">
						Select Month:<input type="month" name="month" class="month" id="month" onchange="myFunction()" placeholder="Select Month" required value="" style="width:auto;border:solid; border-color:black;font-family:Cambria;border-radius:5px;height:30px;margin-bottom:10px" />
					</div>
					<div style="display: inline-block">
						<input type="text" hidden name="dealerid" class="dealerid" id="dealerid" value="<?PHP echo $Emp_No ?>" style="width:100px" />
					</div>
                    
                    <div class="tbl_fixed">
                        <table>
                            <thead>
                                <tr>
                                    <th style="width:5%;">S.no</th>
									<th style="width:10%;">Department</th>
                                    <th style="width:25%;">Description</th>
                                    <th hidden>Indicative Margin %</th>
									<th style="width:6%;">Excavator Target in lakh</th>
									<th style="width:6%;">Excavator Actual in lakh</th>
									<th style="width:6%;">Grader Target in lakh</th>
									<th style="width:6%;">Grader Actual in lakh</th>
									<th style="width:6%;">Wheel Loader Target in lakh</th>
									<th style="width:6%;">Wheel Loader Actual in lakh</th>
									<th style="width:6%;">SLM Target in lakh</th>
									<th style="width:6%;">SLM Actual in lakh</th>
									<th style="width:6%;">Revenue Target in lakh</th>
									<th style="width:6%;">Revenue Actual in lakh</th>
									

                                </tr>
                            </thead>
                            <tbody>
                                <?php

                          
							 $qry=mysqli_query($conn,"SELECT * FROM parts_service ");

                            $n  =   1;
                            while($row = $qry->fetch_assoc()){
                                $Description = $row['Description'];
                                $Department = $row['Department'];
                                $Indicative_Margin = $row['Indicative_Margin'];
                                ?>

                                <tr>
                                    <td align='center'>
                                        <?php echo $n++ ?>
                                    </td>
                                    <td style="text-align:center">
                                        <?php echo $Department; ?>
                                    </td>
                                    <td hidden>
                                        <input type="text" name="Department[]" id="Department" value=" <?php echo $Department; ?> " style="width:100px" readonly />
                                    </td>
                                    <td>
                                        <?php echo $Description; ?>
                                    </td>
                                    <td hidden>
                                        <input type="text" name="Description[]" id='Description' value=" <?php echo $Description; ?> " style="width:100px" readonly />
                                    </td>

                                    <td style="text-align:center" hidden>
                                        <?php echo $Indicative_Margin; ?> %
                                    </td>
                                    <td hidden>
                                        <input type="text" name="Indicative_Margin[]" class="Indicative_Margin" id="Indicative_Margin"  value=" <?php echo $Indicative_Margin; ?> " style="width:100px" readonly />
                                    </td>
									<td style="width:100px">
										<input type="number" class="form-control ExcavatorTarget " name="ExcavatorTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="ExcavatorTarget" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control ExcavatorActual calc" name="ExcavatorActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="ExcavatorActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control GraderTarget " name="GraderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GraderTarget" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control GraderActual calc" name="GraderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GraderActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control WheelLoaderTarget " name="WheelLoaderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="WheelLoaderTarget" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control WheelLoaderActual calc" name="WheelLoaderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="WheelLoaderActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control SLMTarget " name="SLMTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="SLMTarget" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control SLMActual calc" name="SLMActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="SLMActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control RevenueTarget " name="RevenueTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="RevenueTarget" value="" style="width:100%" readonly />
									</td>
                                    <td style="width:100px">
										<input type="number" class="form-control RevenueActual" name="RevenueActual[]" id="RevenueActual" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" value="" style="width:100%" readonly />
                                    </td>

									<td style="width:100px" hidden>
                                        <input type="number" name="Margin[]" class="form-control Margin" id="Margin" value="" style="width:100%" readonly autocomplete="off" />
									</td>
                                    <td hidden align='center' style="width:10%">
                                        <input type="checkbox" checked="checked" class="checkbox" name='lang[]' value="1" />
                                    </td>
                                </tr>

                                <?php
                            }
                                ?>

                            </tbody>
                        </table>
                    </div>
                    <div style="text-align:center">
                        <input type="submit" name="addInvoice" class="addInvoice" id="addInvoice" value="Submit" style="width:100px;background: #0A2558;margin-top:10px; color:white;font-family:Cambria;border-radius:5px;height:30px;" />
                    </div>
                </form>

I dont know how to do this. Van any one help me how to do this

Edited by Senthilkumar
Link to comment
Share on other sites

In a few words tell us what you don't know how to do.  I can't make sense out of this.  Sure - it appears to be a crowded page with a lot of fields.  Are you trying to update multiple records from this one input page?  

What exactly do you want to do?  Keeping it simple will help someone here understand and help you.

Link to comment
Share on other sites

Posted (edited)

Dear ginerjm,

In my databse for Excavator--> Pure Parts --> Jan --> 12 and Excavator--> Rock Breaker --> Jan --> Null.

Example: When i am selecting Jan month on my table i want it should display on S.no:1--> Pure Parts --> Excavator Target in Lakhs --> 12 and S.no:2--> Rock Breaker --> Excavator Target in Lakhs should disblay blank. 

When i am selecting March month on my table i want it should display on S.no:1--> Pure Parts --> Excavator Target in Lakhs --> 098 and S.no:2--> Rock Breaker --> Excavator Target in Lakhs --> 657. 

Like above all the values should display the category target as per the description in databse.

I am not getting any idea, how to do this. 

Edited by Senthilkumar
Link to comment
Share on other sites

the key to converting row data into column output is to index/pivot the data using appropriate array index values when you fetch the data from the query. you would then loop over the indexed data, and for each row of data, loop over the expected column indexes, and test if there is data for the current column. if there's not, you would output an appropriate indicator value or an empty html table cell. if there is data, you would output the existing target value in the 'target' column and output the form field for the entry of the actual value in the 'actual' column.

to index/pivot the data when you fetch it from the query, you would do something like this -

$data = [];
foreach($stmt as $row)
{
	$data[$row['Description']][$row['Category_Name']] = $row;
}

you can examine what the result of doing this looks like using print_r($data).

the form field names would NOT include the category_name as part of them. you would use an array field name, such as 'Actual', with the description value and the category_name value as the array indexes, e.g. - name="Actual[Rock Breaker][Excavator]"

and as was pointed out in one of your previous threads - the point of DRY (Don't Repeat Yourself) code is to NOT write out , copy/paste/overtype, the same logic/markup for every possible value. you should be dynamically outputting things like the html table headings and the target/actual html table cells.

to do this for the code in this thread, you would write out or query for an array of the category_name values for the columns. while you are doing that, you should also define the static parts of the target/actual heading text in variables, e.g. -

$col = ['Excavator','Grader','Wheel Loader','SLM','Revenue'];

$target_txt = 'Target in lakh';
$actual_txt = 'Actual in lakh';

once you do that, you can dynamically produce the html table headings -

<?php
foreach($col as $c)
{
	echo "<th style='width:6%;'>$c $target_txt</th>";
	echo "<th style='width:6%;'>$c $actual_txt</th>";
}
?>

you would loop over the $col values again at the point of dynamically producing the target/actual html table cells.

Edited by mac_gyver
Link to comment
Share on other sites

To be brief and exact as I asked, are you saying that you want to grab a piece of data from a query result (row) and place it into an input tag on our table?

Since I see you are able to do a query (although you need to improve that) you simply take the value of that fetch and add it to the value attribute of the input tag as you output it with your html code.  Over and over.  So - as you retrieve a row you then output the next html table row beginning with a tr tag then multiple td tags and end with a closing tr tag.  Then do another fetch (it's a loop).

Yes - I am being very simplistic here but since you showed us A WHOLE LOT OF CODE I had to wonder what bit you were unable to do.

Link to comment
Share on other sites

Dear Mr.mac_gyver,

 

I had changed the code litelbit as per your suggession. The output of the table is

image.thumb.png.a2fdb08c59831c53ce97aaee83518214.png

In this table the Deparment and Description will update fro the table "parts_service" based on the moth selection

image.png.018d4c3535b9c974aac12666bf1c5693.png

and the target values will display from the table "revenuetarget

image.thumb.png.12a2d36093c3bb95387407fdd5c80f21.png

 

The modified table code is 

<form method="POST" action="" onsubmit="return confirm('Are you sure you want to submit?');">
					<div style="display: inline-block">
						Select Month:<input type="month" name="month" class="month" id="month" onchange="myFunction()" placeholder="Select Month" required value="" style="width:auto;border:solid; border-color:black;font-family:Cambria;border-radius:5px;height:30px;margin-bottom:10px" />
					</div>
					<div style="display: inline-block">
						<input type="text" hidden name="dealerid" class="dealerid" id="dealerid" value="<?PHP echo $Emp_No ?>" style="width:100px" />
					</div>

                    <?PHP
                    $col = ['Excavator', 'Grader', 'Wheel Loader', 'SLM', 'Revenue'];

                    $target_txt = 'Target in lakh';
                    $actual_txt = 'Actual in lakh';


                    ?>
                    
                    <div class="tbl_fixed">
                        <table>
                            <thead>
                                <tr>
                                    <th style="width:5%;">S.no</th>
									<th style="width:10%;">Department</th>
                                    <th style="width:25%;">Description</th>
                                    <?php
                                    foreach($col as $c)
                                    {
	                                    echo "<th style='width:6%;'>$c $target_txt</th>";
	                                    echo "<th style='width:6%;'>$c $actual_txt</th>";
                                    }
                                    ?>
									

                                </tr>
                            </thead>
                            <tbody>
                                <?php

                            // $qry=mysqli_query($conn,"SELECT * FROM users where Approver1_Name = '$Name' OR Approver2_Name = '$Name' ");
							 $qry=mysqli_query($conn,"SELECT * FROM parts_service ");



                            $n  =   1;
                            //while($row = $qry->fetch_assoc()){
                                //$Description = $row['Description'];
                                //$Department = $row['Department'];
                               // $Indicative_Margin = $row['Indicative_Margin'];

                                    $data = [];
                                    foreach ($qry as $row) {
                                        $data[$row['Description']][$row['Category_Name']] = $row;
                                    //}

                                    //print_r($data);

                                ?>

                                <tr>
                                    <td align='center'>
                                        <?php echo $n++ ?>
                                    </td>
                                    <td style="text-align:center">
                                        <?php echo $row['Department']; ?>
                                    </td>
                                    <td hidden>
                                        <input type="text" name="Department[]" id="Department" value=" <?php echo $Department; ?> " style="width:100px" readonly />
                                    </td>
                                    <td>
                                        <?php echo $row['Description']; ?>
                                    </td>
                                    <td hidden>
                                        <input type="text" name="Description[]" id='Description' value=" <?php echo $row;  ?> " style="width:100px" readonly />
                                    </td>

                                    <td style="text-align:center" hidden>
                                        <?php echo $Indicative_Margin; ?> %
                                    </td>
									<td style="width:100px">
										<input type="number" class="form-control ExcavatorTarget " name="ExcavatorTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="ExcavatorTarget" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control ExcavatorActual calc" name="ExcavatorActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="ExcavatorActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control GraderTarget " name="GraderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GraderTarget" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control GraderActual calc" name="GraderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GraderActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control WheelLoaderTarget " name="WheelLoaderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="WheelLoaderTarget" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control WheelLoaderActual calc" name="WheelLoaderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="WheelLoaderActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control SLMTarget " name="SLMTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="SLMTarget" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control SLMActual calc" name="SLMActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="SLMActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control RevenueTarget " name="RevenueTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="RevenueTarget" value="" style="width:100%" readonly />
									</td>
                                    <td style="width:100px">
										<input type="number" class="form-control RevenueActual" name="RevenueActual[]" id="RevenueActual" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" value="" style="width:100%" readonly />
                                    </td>

									<td style="width:100px" hidden>
                                        <input type="number" name="Margin[]" class="form-control Margin" id="Margin" value="" style="width:100%" readonly autocomplete="off" />
									</td>
                                    <td hidden align='center' style="width:10%">
                                        <input type="checkbox" checked="checked" class="checkbox" name='lang[]' value="1" />
                                    </td>
                                </tr>

                                <?php
                            
                                    }
                                ?>

                            </tbody>
                        </table>
                    </div>
                    <div style="text-align:center">
                        <input type="submit" name="addInvoice" class="addInvoice" id="addInvoice" value="Submit" style="width:100px;background: #0A2558;margin-top:10px; color:white;font-family:Cambria;border-radius:5px;height:30px;" />
                    </div>
                </form>

 

Can you please suggest me for this

Link to comment
Share on other sites

indexing/pivoting the data is a completely separate step. you need to build and execute the query (which isn't even attempting to use the dealer id, year, and month) to match the data that you want. index/pivot the data. then -

5 hours ago, mac_gyver said:

you would then loop over the indexed data, and for each row of data, loop over the expected column indexes, and test if there is data for the current column. ...

edit: i recommend that you get up to the point of using print_r() on the indexed/pivoted data so that you can see what it is. this  may give you an idea of what the code that produces the output will need to do.

Edited by mac_gyver
Link to comment
Share on other sites

Tell us what you don't know how to do in a few words.  I don't get this. Sure, it looks crowded with a lot of fields, but I don't get it.  Is this one input page supposed to update multiple records?  

How would you like to proceed?  It will be easier for someone here to understand and help you if you keep it simple.

  • Like 1
Link to comment
Share on other sites

I am setting the target for all my descriptions monthly wise to my all dealers. 

The dealer will enter the actual vaues monthly wise and submit the form. So when the dealer is selecting the month, he wants to know what is his target for the description on that particular selected month.

This is the concept of these page.

Link to comment
Share on other sites

we can only help with specific programming questions. what exactly are you currently having a problem with?

have you successfully used the month and dealerid inputs (which should be from a get method form) to query for the data that you want?

Link to comment
Share on other sites

Clearly you are floundering and unsure how to proceed.  That is easy enough to see from the code you posted.  

The way to attack this (and to program in general) is to break things into smaller pieces.  Those pieces are functions and/or methods.  

There is no way for anyone to help you at this point without writing the code for you. 

Start thinking about how to break your problem into smaller pieces.  Those individual pieces can be turned into functions, which you can test individually.  This is one of the reasons that people write unit tests with phpunit.

The other problem with your code, is that you have no separation between the logic, html markup and organization of data.  This problem of disorganization is so common, that the Model-View-Controller (MVC) pattern became widely adopted in order to solve it.

One way you could start to see where you need functions or methods, would be to take the markup you have and mock up all the final data.

Another issue with what you are asking for, is that it presupposes a lot of javascript.  You essentially are presenting an input table, where you have a lot of cells, corresponding with your poorly designed database table, and you are asking how an html/javascript UI can be created to allow update of that. There isn't one answer to this, so again, people aren't going to just write you up a bunch of code.

Personally, I refuse to work on questions where the underlying relational database structure is fundamentally incorrect, and yours falls into that category.  Your revenuetarget table with it's 12 month columns is an example of a repeating group.  Rather than having one row per year, you should have a table that has a "month" column, just as you have "year" column, and there should be a row for each month. 

Link to comment
Share on other sites

  • 2 weeks later...

Dear mac_gyver,

as per your guidness I have included the Category name and Description on table column ID. My table <tr> code is


                                <tr>
                                    <td align='center'>
                                        <?php echo $n++ ?>
                                    </td>
                                    <td style="text-align:center">
                                        <?php echo $row['Department']; ?>
                                    </td>
                                    <td hidden>
                                        <input type="text" name="Department[]" id="Department" value=" <?php echo $row['Department']; ?> " style="width:100px" readonly />
                                    </td>
                                    <td>
                                        <?php echo $row['Description']; ?>
                                    </td>
                                    <td hidden>
                                        <input type="text" name="Description[]" id='Description' value=" <?php echo $row['Description'];  ?> " style="width:100px" readonly />
                                    </td>
                                    <td style="text-align:center" hidden>
                                        <?php echo $row['Indicative_Margin']; ?>
                                    </td>
                                    <td hidden>
                                        <input type="text" name="Indicative_Margin[]" id="Indicative_Margin" class="Indicative_Margin" value=" <?php echo $row['Indicative_Margin'];  ?> " style="width:100px" readonly />
                                    </td>
                                    
									<td style="width:100px">
                                        <input type="number" class="form-control ExcavatorTarget " name="ExcavatorTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id=" EXCAVATOR<?php echo $row['Description']; ?>" value="" style="width:100%" />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control ExcavatorActual calc" name="ExcavatorActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="ExcavatorActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
                                        <input type="number" class="form-control GraderTarget " name="GraderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GRADER<?php echo $row['Description']; ?>" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control GraderActual calc" name="GraderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="GraderActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
                                        <input type="number" class="form-control WheelLoaderTarget " name="WheelLoaderTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id=" WHEELLOADER<?php echo $row['Description']; ?>" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control WheelLoaderActual calc" name="WheelLoaderActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="WheelLoaderActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
                                        <input type="number" class="form-control SLMTarget " name="SLMTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id=" SLM<?php echo $row['Description']; ?>" value="" style="width:100%" readonly />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control SLMActual calc" name="SLMActual[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="SLMActual" value="" style="width:100%" />
									</td>
									<td style="width:100px">
										<input type="number" class="form-control RevenueTarget " name="RevenueTarget[]" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" id="RevenueTarget" value="" style="width:100%" readonly />
									</td>
                                    <td style="width:100px">
										<input type="number" class="form-control RevenueActual" name="RevenueActual[]" id="RevenueActual" step="0.01" pattern="^\d+(?:\.\d{1,2})?$" value="" style="width:100%" readonly />
                                    </td>

									<td style="width:200px" >
                                        <input type="number" name="Margin[]" class="form-control Margin" id="Margin" value="" style="width:100%" readonly autocomplete="off" />
									</td>
                                    <td hidden align='center' style="width:10%">
                                        <input type="checkbox" checked="checked" class="checkbox" name='lang[]' value="1" />
                                    </td>
                                </tr>

 

Then i am fetching values from the php. My php code is

<?php
// Include the database config file
include("../connection.php");
//error_reporting(0);
error_reporting(E_ALL);

ini_set('display_errors', '1');
//ini_set('display_errors','Off');

if(!empty($_POST["month"]) ){
    $Month=$_POST["month"];
    $dealerid = $_POST["dealerid"];
    $Mon = date('M', strtotime($Month));

    //$Category_Name = $_POST["Category_Name"];
   // $Description = $_POST["Description"];

		$sql = "select $Mon,Category_Name,Description from revenuetarget WHERE Dealer_ID = '$dealerid'";
		$result = mysqli_query($conn, $sql);

        while ($row = mysqli_fetch_array($result)) {

            $Category_Name = $row['Category_Name'];
            $Description = $row['Description'];
            $Month_Value = $row[$Mon];

            $return_arr[] = array(
                "Category_Name" => $Category_Name,
                "Description" => $Description,
                "Month_Value" => $Month_Value,
            );

        }

    echo json_encode($return_arr);
}
?>

Then i am setting the values on the column id using ajax. Ajax code is 

<script>//..................month hide function
        function myFunction() {

                    var key = $(this).attr('data-key');

               var month = document.getElementById("month").value;
               var dealerid = document.getElementById("dealerid").value;
            //var Description = document.getElementById("Description").value;
                      // var Description = $("#Description").val();



		        $.ajax({
                    type: 'POST',
                    dataType: 'JSON',
                   url: 'Revenue_Data.php',
                  data: 'month=' + month + '&dealerid=' + dealerid,
		          //data: 'month=' + month + '&dealerid=' + dealerid,
                    success: function (response) {
                        var len = response.length;


                        for (var i = 0; i < len; i++) {
                                var Category_Name = response[i].Category_Name;
                                var Description = response[i].Description;
                                var Month_Value = response[i].Month_Value;

                           // document.getElementById("WheelLoaderTarget").value = Month_Value;
                            document.getElementById(Category_Name + Description).value = Month_Value;
                        }

                    }
               });
           }

	</script>

 

But the value is not appending on the table.  Can you please check and confirm the mistake

Link to comment
Share on other sites

  • 2 weeks later...
On 6/30/2023 at 10:05 AM, Senthilkumar said:
document.getElementById(Category_Name + Description).value = Month_Value;

Which of your input fields above is that value aimed at?

The only one I can see that looks like a contender is the one with

id=" EXCAVATOR<?php echo $row['Description']; ?>"

but that one begins with a space - the category is always (hard-coded)  " EXCAVATOR"

Link to comment
Share on other sites

  • Solution

Dear Barand,

 

Thanks for your reply. It is the problem of space on the the ID name. Now i removed the space on Category and Description using the bellow code

$Description = str_replace(' ', '', $row['Description']);

Now all the target values are updating properly

image.thumb.png.8788883360166980a850cf37dca2b5bc.png

 

Once again thank you team for supporting me to complete this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.