สอบถาม การดึงข้อมูลที่กรอกมาโชว์

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

hayatee
PHP Super Hero Member
PHP Super Hero Member
โพสต์: 670
ลงทะเบียนเมื่อ: 19/04/2021 10:01 am

สอบถาม การดึงข้อมูลที่กรอกมาโชว์

โพสต์ที่ยังไม่ได้อ่าน โดย hayatee »

ทำการป้อนข้อมูล ชื่อผู้ใช้งาน จำนวนเงิน ค่าหัก ณ ที่จ่าย(list box)
Programming - PHP-1.png
Programming - PHP-1.png (38.17 KiB) Viewed 1689 times
ข้อมูลที่กรอกจะแสดง จากนั้นกดปุ่มแสดงข้อมูล
Programming - PHP-1.png
Programming - PHP-1.png (47.28 KiB) Viewed 1690 times
ให้ข้อมูลที่เราป้อนไว้ ให้มันแสดงขึ้น ดังภาพตรงนี้ค่ะ
Programming - PHP-2.png
Programming - PHP-2.png (74.51 KiB) Viewed 1690 times
หน้า index.php

โค้ด: เลือกทั้งหมด

<?php

require_once 'conn.php';
include '../head_html.php';
include '../config.php';
include '../header.php';

?>
<link rel="stylesheet" href="../css/color.css">


<meta property="og:url"           content="<?php echo ((array_key_exists('HTTPS', $_SERVER) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>" />
<meta property="og:type"          content="website" />
<meta property="og:title"         content="<?php echo $lang_progrcalculatetax;?>" />
<meta property="og:description"   content="<?php echo $lang_progrcalculatetax;?>" />
<meta property="og:image"         content="https://www.mindphp.com/images/content/Tool/M-Tax-Calculator.png" />
<meta property="og:image:alt"     content="<?php echo $lang_progrcalculatetax; ?>" />
<meta name="keywords"             content="<?php echo $lang_progrcalculatetaxk;?>" />

<title><?php echo $lang_progrcalculatetax;?></title>
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "SoftwareApplication",
    "name": "Homeloan Calculator",
    "image": "https://www.mindphp.com/images/info/mindphp-logo-v40.png",
    "description": "โปรแกรมหายอดหลังหัก ณ ที่จ่าย",
    "applicationCategory": "http://schema.org/GameApplication",
    "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.3",
    "ratingCount": "31242"
    },
    "offers": {
    "@type": "Offer",
    "price": "1.00",
    "priceCurrency": "USD"
    }
    }
</script>

<?php


include '../PHP-Pagination-master/Pagination.class.php';

$page = 1;
if(isset($_GET['page'])){
	$page = $_GET['page'];
}


// ดาต้าเบสที่ปิดไว้ลอง รันหน้าเปล่าๆดูก่อน

$row = 10;
$total_data = "SELECT COUNT(no) FROM $data";
$result_1 = mysqli_query($conn, $total_data);
$total = mysqli_fetch_row($result_1);
$total_data = $total[0];
$Pagination = new Pagination($page,$total_data);
$Pagination->parse();
$start = ($page - 1)* $row;



?>

<div class="container">
    <div class="col-md-12">
        <div class="row">
            <!--pathway-->
            <div class="btn-group btn-breadcrumb">
                <a href="#" class="btn btn-default"><?php echo $lang_youarehere;?>:</a>
                <a href="https://www.mindphp.com/online-tools/mindphp-tools.html" class="btn btn-default"><?php echo $lang_tools;?></a>
                <a href="index.php?lang=<?php echo $lang; ?>" class="btn btn-primary"><?php echo $lang_progrcalculatetax;?></a>
            </div>

        </div><br>
    </div>
    <div class="row">


        <!--menu-->
        <div class="col-md-4">
            <?php include 'menu_sidebar.php'; ?>
        </div>
        <div class="col-md-8">
            <div class="col-md-12">
                <?php include 'script_facebook.php'; ?>
            </div>
        </div><br>
        <div class="col-md-8">
            <form method="post" action="" name="from">
                <div class="panel-group">
                    <div class="panel panel-primary" align="center">


<!-- //เติม , (คอมมา) -->
<script src="jquerynum/jquery.number.js"></script>
<script type="text/javascript">

			$(function(){
				// Set up the number formatting.
				$('#moneys').number( true, 2 );


				// Get the value of the number for the demo.
				$('#get_number').on('click',function(){

					var val = $('#moneys').val();

					$('#number_container').slideDown('fast');
					$('#the_number').text( val !== '' ? val : '(empty)' );
				});
			});
		</script>


                        <div class="panel-heading"><b><?php echo $lang_program_home ?></b></div>
                        <div class="panel-body" >
                            <div class="input-group">
                                <span class="input-group-addon alert-info" id="basic-addon1"><?php echo $lang_name;?></span>
                                <input type="text" required name="name" class="form-control" autocomplete="off" placeholder="<?php echo $lang_enteryourname;?>" value="">
                            </div><br>
                            <div class="input-group"><span class="input-group-addon alert-info" id="basic-addon1"><?php echo $lang_amount;?></span>
                                <input type="text" id="moneys" required name="price" class="form-control text-right"  placeholder="0.00" value="">
                                <span class="input-group-addon alert-info"><?php echo $lang_baht;?> </span>
                            </div><br>

                            <div class="input-group"><span class="text-center" id="basic-addon1"><?php echo $lang_withholdingtax . ":";?></span> 
                            <?php 
                                    $sql = "SELECT * FROM tools_deduction"; 
                                    $result = mysqli_query($conn, $sql);   
                            ?>
                                <select name="wht" >
                                    <?php  while ($fetch = mysqli_fetch_array($result)) { ?>
                                        <option value = "<?php echo $fetch['wht_no'] ?>" > <?php echo $fetch['wht_name'] ?> </option>
                                            
                                    <?php } ?>                
                                </select>

                                </div><br>

                            <!-- <script src='https://www.google.com/recaptcha/api.js'></script>
                        <div class="col-md-12">
                            <div align="center" class="g-recaptcha" required data-sitekey="<?php echo $keyrecaptcha; ?>"></div><br>
                        </div> -->
                            <br>
                            <input type="submit" name="submit" class="btn btn-success" value="<?php echo $lang_calculate;?>" >
                            <input type="reset" name="reset" class="btn btn-warning" onclick="window.location = 'index.php?lang=<?php echo $lang; ?>';">
                            
                            <?php
                            // if (isset($_POST['g-recaptcha-response'])) {
                            // $keyrecaptcha = $_POST['g-recaptcha-response'];
                            // if (empty($keyrecaptcha)) {
                            // if (isset($_POST['g-recaptcha-response'])) {
                            // $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $secretkeyrecaptcha . "&response=" . $keyrecaptcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']), true);
                            // ?>
                             <?php
                            // if (!$keyrecaptcha) {
                            // $missinginputsecret = $lang_automatedprogram;
                            // ?>

                             <br><div align="center" class="errorip-color"><b><?php //print_r($missinginputsecret) ?></b></div>
                             <?php
                            // }
                            // }
                            // } else {
                            //     $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $secretkeyrecaptcha . "&response=" . $keyrecaptcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']), true);
                            

                            // if (isset($_POST['name']) && $response['success'] == true) {
                            // echo '<input type = "hidden" name = "id" value = "' . $_POST['name'] . '" />';
                            // }


                            if (isset($_GET['no'])) {
                                echo '<input type = "hidden" name = "no" value = "' . $_GET['no'] . '" />';
                            }
                            if (isset($_POST['submit'])) {

                                $name = $_POST['name'];  //รับชื่อ
                                $numbzz = $_POST['price']; //รับค่าเงินต้น
                                $numbz  =  $numbzz;         //จำนวนเงิน
                                $taxx =  $_POST['wht']; 
                                $numbz= str_replace(',','', $numbz); //ตัดสตริง , ออกเพื่อมาเลชมาคำนวณ
                                $textex = ($numbz * 100 ) /107 ;  //ค่าถอด vat
                                $tex2 = $textex ;

                                date_default_timezone_set("Asia/Bangkok");
                                $datetime = time();
                                $date = date("Y-m-d  H:i:s", time());
                                $ip = $_SERVER["REMOTE_ADDR"];
                                ?>

                                <div align="center">
                                    <h3><?php echo $lang_userinformation;?></h3>
                                    <table class="table">
                                        <tbody>

                                    <!--  TEST   -->
                                    <!--  ชื่อ ผู้ใช้้งาน   -->
                                            <tr class="warning">
                                                <td align="right" width="50%">
                                                    <?php echo "สวัสดีคุณ : "; ?>
                                                </td>
                                                <td>
                                                <?php echo $name ?>
                                                </td>
                                            </tr>

                                    <!--  เงินต้น  -->
                                            <tr class="active">
                                                <td align="right" width="50%">
                                                    <?php echo $lang_aftertax. " : "; ?>
                                                </td>
                                                <td>
                                                <?php echo number_format($numbz, 2)."  ". $lang_baht; ?>
                                                </td>
                                            </tr>


                                    <!--  ค่าหัก ณ ที่จ่าย    -->
                                       
                                            <tr class="warning">
                                                <td align="right" width="50%">
                                                 <?php echo $lang_amounttaxwithho." : "; ?>
                                                  </td>
                                                     <td>
                                                       <?php
                                                            $sql = "select wht_name from tools_deduction where wht_no='".$_POST['wht']."'";
                                                            $result = mysqli_query($conn, $sql);
                                                                while ($fetch = mysqli_fetch_assoc($result)) {
	                                                            echo $fetch['wht_name'];
                                                            } 
                                                        ?>

                                                    </td>
                                                </tr>
       

                                    <!--  ยอดหัก ณ ที่จ่าย    -->
                                            <tr class="active">
                                                <td align="right" width="50%">
                                                <?php echo $lang_deductedamount." : "; ?>
                                                 </td>
                                                    <td>
                                                        <?php $tax_percent = ($tex2 * $taxx) / 100 ;?>
                                                        <?php echo number_format($tax_percent, 2)." ". $lang_baht."<br>"; ?>
                                                    </td>
                                                </tr> 

                                    <!-- ยอดภาษี ณ ที่จ่าย    -->
                                            <tr class="active">
                                                <td align="right" width="50%">
                                                <?php echo $lang_withholdingamount." : "; ?>
                                                </td>
                                                    <td>
                                                        <?php  $textex = ($numbz * 100 ) /107 ; ?>
                                                        <?php echo number_format($textex, 2)." ". $lang_baht."<br>"; ?>
                                                    </td>
                                             </tr>

                                    <!--  จำนวนเงินที่จ้องชำระจริง   -->
                                            <tr class="active">
                                                <td align="right" width="50%">
                                                    <?php echo $lang_beforetax." : "; ?>
                                                </td>
                                                    <td>
                                                        <?php $totaltax = $numbz - $tax_percent ?>
                                                    
                                                        <?php echo number_format($totaltax, 2)." ". $lang_baht."<br>"; ?>
                                                </td>
                                            </tr>

                                            <!--  ตัวอักษร จำนวนเงินภาษีหัก ณ ที่จ่าย   -->
                                            <tr class="warning">
                                                <td align="right" width="50%">
                                                     <?php echo $lang_textnumder." : "; ?>
                                                      </td>
                                                         <td>
                                                            <?php $engno = number_format($totaltax, 2)?>
                                                            <?php $engno = str_replace(',','', $engno); ?>
                                                            <?php $textnum = ($lang == 'th') ? convert($totaltax) : Currency::bahtEng($engno) ;  ?>
                                                            <?php echo $textnum ; ?>
                                                        </td>
                                            </tr>

                                            <tr class="warning">
                                                <td align="right" width="50%">
                                                    <?php echo $lang_activetime." : "; ?>
                                                </td>
                                                <td>
                                                    <?php echo date("Y-m-d  H:i:s", time()); ?>
                                                </td>
                                            </tr>
                                            <tr class="active">
                                                <td align="right" width="50%">
                                                    <?php echo $lang_yoouripis." : "; ?>
                                                </td>
                                                <td>
                                                    <?php echo $ip; ?>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>





<!----------------------------------------------------  กราฟ    ---------------------------------------------- -->


                               <?php

                              //พอกดคำนวณ SQL ด้านล่างนี้คือ ตัวบันทึกลงฐานข้อมูล ว่าบันทึกอะไรบ้าง
                                $name2= str_replace("'",'', $name);
                                $sql_insert = "INSERT INTO tools_calculate_payment (name,money,wht,totalwht,tax,total,time,ip)"
                               . "VALUES ('$name2','$numbz','$taxx','$tax_percent', '$textex', '$totaltax','$date','$ip')"; 
                               //echo $sql;exit();
                               mysqli_query($conn, $sql_insert); 
                               //or die($lang_datacannot);  
                               
                                  }

                                //}
                               //}
                            ?>
                        </div>
                        <div align="right"><?php echo $lang_vercheckpace." ". $tax;?>&nbsp;&nbsp;&nbsp;
                        <br>
                        <br>

                        </div>
                    </div>
                </div>
            </form>

            <?php include 'tags.php'; ?>

            <div class="well2">
            <br>
            <ul>
                <b><?php echo $lang_step_how ?></b>
                <li><?php echo $lang_inputname_usere ?> <b><?php echo $lang_name?></b></li>
                <li><?php echo $lang_money_loan ?> </li>
                <li><?php echo $lang_arr_inter?> </li>
                <li><?php echo $lang_lang_putbtt?></li>
            </ul>
        </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12 well well-lg">
            <?php include 'content.php'; ?>
        </div>
    </div>



    <!-- ข้อมูลการใช้งานล่าสุด -->
    <div class="row">
        <div class="col-md-12 table-responsive" align="center">
            <h3 align="center"><?php echo $lang_recentinformation;?></h3>
            <table class="table table-striped">
                <thead class="bg-primary" align="center">
                    <tr>
                        <th>
                            <p align="center"><?php echo $lang_no;?></p>
                        </th>
                        <th>
                            <p align="center"><?php echo $lang_name;?></p>
                        </th>
                        <th>
                            <p align="center"><?php echo $lang_amount; //จำวนเงินที่ vat แล้ว ?></p>
                        </th>
                        <th>
                            <p align="center"><?php echo $lang_withholdingtax; //ค่าหัก ณ ที่จ่าย ?></p>
                        </th>

                        <th>
                            <p align="center"><?php echo $lang_totaldeduction; //ยอดหัก ณ ที่จ่าย ?></p>
                        </th>

                        <th>
                            <p align="center"><?php echo $lang_taxs; //ยอดภาษี ณ ที่จ่าย ?></p>
                        </th>

                        <th>
                            <p align="center"><?php echo $lang_interest; //ยอดที่ต้องชำระจริง ?> </p>  
                        </th>
                        <th>
                            <p align="center"><?php echo $lang_activetime;?></p>
                        </th>

                        <th>
                            <p align="center"><?php echo $lang_yoouripis;?></p>
                        </th>
                        <th>
                            <p align="center"><?php echo $lang_showinformation;?></p>
                        </th>
                    </tr>
                </thead>


               <!-- ฐานข้อมูลแสดง ผู้ใช้งานล่าสุด --> 
                <?php
                //    $sql = "SELECT * FROM tools_calculate_payment ORDER BY no desc Limit 0,10";
                        $sql = "SELECT * FROM tools_calculate_payment 
                                INNER JOIN tools_deduction ON tools_deduction.wht_no = tools_calculate_payment.wht 
                                where tools_calculate_payment.no ORDER BY no desc Limit 0,10 ";

                            //echo $sql;exit;
                        $result2 = mysqli_query($conn, $sql);
                        while ($fetch = mysqli_fetch_assoc($result2)) {

                          
                ?> 

                    <tr align="center">
                    <td>
                        <?php echo $fetch['no']; ?>
                    </td>
                    <td>
                        <?php echo $fetch['name']; ?>
                    </td>
                    <td>
                        <?php echo number_format($fetch['money'], 2); ?>
                    </td>
                    <td>
                        <?php echo ($fetch['wht_name']) ;  ?>
                    </td>
                    <td>
                        <?php echo number_format($fetch['totalwht'], 2); ?>
                    </td>
                    <td>
                        <?php echo number_format($fetch['tax'], 2); ?>
                    </td>
                    <td>
                        <?php echo number_format($fetch['total'], 2); ?>
                    </td>
                    <td>
                        <?php echo  $fetch['time'];?>
                    </td>
                    <td>
                        <?php include 'ip.php'; ?>
                    </td>
                    <td>
                            <a href="showhome.php?no=<?php echo $fetch['no']; ?>&lang=<?php echo $lang; ?>">
                                <i class="glyphicon glyphicon-new-window"></i>
                            </a>
                        </td>

                        
                </tr>

                    <?php
                }
                ?>
            </table>

            <div class="text-center">
            	<nav aria-label="page navigation">
            		<?php echo $Pagination->parse(); ?>
            	</nav>

            </div>
            
            <input type="button" class="btn btn-primary" onclick="window.location = 'listhomeloan.php?lang=<?php echo $lang; ?>';" value="<?php echo $lang_seemore;?>">
        </div>
    </div>
</div>
<?php include '../footer.php'; ?>
หน้า showhome.php

โค้ด: เลือกทั้งหมด

<?php
ob_start();

require_once'conn.php';
include '../head_html.php';
include '../PHP-Pagination-master/Pagination.class.php';
?>

<meta property="og:url"           content="<?php echo ((array_key_exists('HTTPS', $_SERVER) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>" />
<meta property="og:type"          content="website" />
<meta property="og:title"         content="<?php echo $lang_des_show;?>" />
<meta property="og:description"   content=" <?php echo $lang_des_show;?> " />
<meta property="og:image"         content="https://www.mindphp.com/images/content/Tool/M-Tax-Calculator.png" />
<meta property="og:image:alt"     content="<?php echo $lang_progrcalculatetax; ?>" />
<meta name="keywords"             content="<?php echo $lang_des_showk;?>" />

<title><?php echo $lang_displaythetax;?></title>
<script type="application/ld+json">
{
        "@context": "http://schema.org",
        "@type": "SoftwareApplication",
        "name": "Tax Calculator",
        "image": "https://www.mindphp.com/images/info/mindphp-logo-v40.png",
        "description": "โปรแกรมคำนวณภาษีหัก ณ ที่จ่าย",
        "operatingSystem": "Windows 7",
        "applicationCategory": "http://schema.org/GameApplication",
        "aggregateRating": {
                  "@type": "AggregateRating",
                 "ratingValue": "4.3",
                 "ratingCount": "31242"
        },
         "offers": {
                 "@type": "Offer",
                 "price": "1.00",
                  "priceCurrency": "USD"
        }
}
</script>


<?php


$page = 1;
if(isset($_GET['page'])){
	$page = $_GET['page'];
}


// ดาต้าเบสที่ปิดไว้ลอง รันหน้าเปล่าๆดูก่อน

$row = 10;
$total_data = "SELECT COUNT(no) FROM $data";
$result_1 = mysqli_query($conn, $total_data);
$total = mysqli_fetch_row($result_1);
$total_data = $total[0];
$Pagination = new Pagination($page,$total_data);
$Pagination->parse();
$start = ($page - 1)* $row;

?>

<?php
include '../header.php';

// if (isset($_GET['no'])) {
//     $sql = "SELECT * FROM $data WHERE no = " . $_GET['no'];
//     $result = mysqli_query($conn, $sql);
//     $fetch = mysqli_fetch_assoc($result);
// }
// 


    $no = $_REQUEST['no'];
        $sql1 ="SELECT * FROM tools_calculate_payment          
                INNER JOIN tools_deduction ON tools_deduction.wht_no = tools_calculate_payment.wht 
                where no = '".$no."'";

        // $sql1 = "SELECT * FROM tools_calculate_payment 
        // INNER JOIN tools_deduction ON tools_deduction.wht_no = tools_calculate_payment.wht 
        //     where tools_calculate_payment.no ORDER BY no desc Limit 0,10 ";

        $query1 = $conn->query($sql1);
        $result1 = mysqli_fetch_assoc($query1);

?>





<div class="container">
    <!--pathway-->
    <div class="col-md-12">
        <div class="row">
            <div class="btn-group btn-breadcrumb">
                <a href="#" class="btn btn-default"><?php echo $lang_youarehere;?>:</a>
                <a href="https://www.mindphp.com/online-tools/mindphp-tools.html" class="btn btn-default"><?php echo $lang_tools;?></a>
                <a href="index.php?lang=<?php echo $lang; ?>" class="btn btn-default"><?php echo $lang_progrcalculatetax;?></a>
                
                <!-- <a href="listhomeloan.php?lang=<?php //echo $lang; ?>" class="btn btn-default"><?php //echo $lang_listtable;?></a> -->
                
                    <?php
                    $dataname = (isset($fetch['name'])) ? $fetch['name'] : '';
                    $dataprice = (isset($fetch['money'])) ? $fetch['money'] : '';
                    $taxx = (isset($fetch['taxx'])) ? $fetch['taxx'] : '';
                    //echo $lang_you."  " . $dataname . $lang_amount."  " . $dataprice ."  ".$lang_baht;
                    ?>
                </a>

            </div>
        </div><br>
    </div>
    <div class="row"> 


 <!--menu-->
        <div class="col-md-4">
            <?php include 'menu_sidebar.php'; ?>
        </div>
        <div class="col-md-8">
            <div class="col-md-12">
                <?php include 'script_facebook.php'; ?>
            </div>
        </div>
        <br>


<!-- //เติม , (คอมมา) -->
<script src="jquerynum/jquery.number.js"></script>
<script type="text/javascript">

			$(function(){
				// Set up the number formatting.
				$('#moneys').number( true, 2 );


				// Get the value of the number for the demo.
				$('#get_number').on('click',function(){

					var val = $('#moneys').val();

					$('#number_container').slideDown('fast');
					$('#the_number').text( val !== '' ? val : '(empty)' );
				});
			});
		</script>




        <div class="col-md-8">
            <form method="post" action="" name="form">
                <div class="panel-group">
                    <div class="panel panel-primary" align="center">
                        <div class="panel-heading"><b><?php echo $lang_progcalcutaxwith;?></b></div>
                        <div class="panel-body">
                            <div class="input-group">
                                <span class="input-group-addon alert-info" id="basic-addon1"><?php echo $lang_name;?></span>
                                <input type="text" required name="name" class="form-control" autocomplete="off" placeholder="<?php echo $lang_enteryourname;?>" value="<?php echo $dataname; ?>">
                            </div><br>
                        <div class="input-group"><span class="input-group-addon alert-info" id="basic-addon1"><?php echo $lang_amount;?></span>
                                <input type="text" id="moneys" required name="price" class="form-control text-right"  placeholder="0.00" value="<?php echo $dataprice; ?>">
                                <span class="input-group-addon alert-info"><?php echo $lang_baht;?> </span>
                            </div><br>
                            <div class="input-group"><span class="text-center" id="basic-addon1"><?php echo $lang_withholdingtax . ":";?></span>

                            <?php 
                                    $sql = "SELECT * FROM tools_deduction"; 
                                    $result = mysqli_query($conn, $sql);   
                            ?>

                            
                                <select name="wht" >
                                    <?php  while ($fetch = mysqli_fetch_array($result)) { ?>
                                        <option value = "<?php echo $fetch['wht_no'] ?>" > <?php echo $fetch['wht_name'] ?> </option>
                                            
                                    <?php } ?>                
                                </select>

                                </div><br>


                                        <input type="submit" name="submit" class="btn btn-success" value="<?php echo $lang_calculate;?>" >
                                        <input type="reset" name="reset" class="btn btn-warning" onclick="window.location = 'index.php?lang=<?php echo $lang; ?>';"><br><br>


                            <?php
                            if (isset($_GET['wht'])) {
                                echo '<input type = "hidden" name = "wht_no" value = "' . $_GET['wht'] . '" />';
                            }
                            if (isset($_POST['submit'])) {

                                $name = $_POST['name'];  //รับชื่อ
                                $numbzz = $_POST['price']; //รับค่าเงินต้น
                                $numbz  =  $numbzz;         //จำนวนเงิน
                                $taxx =  $_POST['wht']; 
                                $numbz= str_replace(',','', $numbz); //ตัดสตริง , ออกเพื่อมาเลชมาคำนวณ
                                $textex = ($numbz * 100 ) /107 ;  //ค่าถอด vat
                                $tex2 = $textex ;


                                date_default_timezone_set("Asia/Bangkok");
                                $datetime = time();
                                $date = date("Y-m-d  H:i:s", time());
                                $ip = $_SERVER["REMOTE_ADDR"];


                                $name2= str_replace("'",'', $name);
                                $sql = "INSERT INTO $data (name,money,wht,totalwht,tax,total,time,ip)"
                                . "VALUES ('$name2','$numbz','$taxx','$tax_percent','$textex','$totaltax','$date','$ip')";
                                mysqli_query($conn, $sql) or die($lang_datacannot);

                                $last_id = mysqli_insert_id($conn);
                                header("location: ../exclude_tax/showhome.php?id=$last_id");
                                exit(0);
                            }
                            
                            
                            ?>


                            
                              <!--ฟังชั้นคำอ่าน -->
                            <?php
                            // function Convert($amount_number)
                            // {
                            //   $amount_number = number_format($amount_number, 2, ".","");
                            //   $pt = strpos($amount_number , ".");
                            //   $number = $fraction = "";
                            //   if ($pt === false)
                            //     $number = $amount_number;
                            //     else
                            //     {
                            //       $number = substr($amount_number, 0, $pt);
                            //       $fraction = substr($amount_number, $pt + 1);
                            //     }
                            //
                            //     $ret = "";
                            //     $baht = ReadNumber ($number);
                            //     if ($baht != "")
                            //     $ret .= $baht . "บาท";
                            //
                            //     $satang = ReadNumber($fraction);
                            //     if ($satang != "")
                            //     $ret .=  $satang . "สตางค์";
                            //     else
                            //     $ret .= "ถ้วน";
                            //     return $ret;
                            //   }
                            //
                            //   function ReadNumber($number)
                            //   {
                            //     $position_call = array("แสน", "หมื่น", "พัน", "ร้อย", "สิบ", "");
                            //     $number_call = array("", "หนึ่ง", "สอง", "สาม", "สี่", "ห้า", "หก", "เจ็ด", "แปด", "เก้า");
                            //     $number = $number + 0;
                            //     $ret = "";
                            //     if ($number == 0) return $ret;
                            //     if ($number > 1000000)
                            //     {
                            //       $ret .= ReadNumber(intval($number / 1000000)) . "ล้าน";
                            //       $number = intval(fmod($number, 1000000));
                            //     }
                            //
                            //     $divider = 100000;
                            //     $pos = 0;
                            //     while($number > 0)
                            //     {
                            //       $d = intval($number / $divider);
                            //       $ret .= (($divider == 10) && ($d == 2)) ? "ยี่" :
                            //       ((($divider == 10) && ($d == 1)) ? "" :
                            //       ((($divider == 1) && ($d == 1) && ($ret != "")) ? "เอ็ด" : $number_call[$d]));
                            //       $ret .= ($d ? $position_call[$pos] : "");
                            //       $number = $number % $divider;
                            //       $divider = $divider / 10;
                            //       $pos++;
                            //     }
                            //     return $ret;
                            //   }
                             
                             ?>

                            <!--แสดงผลตอนกด ดูข้อมูลจากหน้า index -->
                            
                            <div class="row">
                                <h3><?php echo $lang_userinformation;?></h3>
                                <table id="table-listtax" class="table table-striped">
                                    
                                    <tbody>
                                        <tr class="active">
                                                <td width="50%">
                                                    <p><b><?php echo $lang_no;?></b></p>
                                                </td>
                                            <td>
                                                <?php echo $result1['no'] ?>
                                            </td>
                                        </tr>

                                        <tr class="warning">
                                                <td>
                                                    <p><b><?php echo $lang_name;?></b></p>
                                                </td>
                                            <td>
                                                <?php echo $result1['name']; ?>
                                            </td>
                                        </tr>
                                        
                                        <tr class="active">
                                            <td>
                                                <p><b><?php echo $lang_amount;?></b></p>
                                            </td>
                                            <td>
                                            <?php echo $result1['money'];?>
                                            </td>
                                        </tr>

                                        <tr class="active">
                                            <td>
                                                <p><b><?php echo $lang_withholdingtax;?>%</b></p>
                                            </td>
                                            <td>
                                            
                                            <?php echo ($result1['wht_name']); ?>
                                            </td>
                                        </tr>

                                        <tr class="active">
                                            <td>
                                                <p><b><?php echo $lang_totaldeduction;?></b></p>
                                            </td>
                                            <td>
                                            
                                            <?php echo number_format($result1['totalwht'], 2); ?>
                                            </td>
                                        </tr>

                                        <tr class="warning">
                                            <td>
                                                <p><b><?php echo $lang_taxs;?> </b></p>
                                            </td>
                                            <td>
                                            <?php echo number_format($result1['tax'], 2); ?>
                                            </td>
                                        </tr>
                                        <tr class="active">
                                            <td>
                                                <p><b><?php echo $lang_interest;?></b></p>
                                            </td>
                                            <td>
                                            <?php echo number_format($result1['total'], 2); ?>
                                            </td>
                                            <tr class="warning">
                                                  <td>
                                                      <p><b><?php echo $lang_textnumder." : "; ?></b></p>
                                                  </td>
                                                  <td>
                                                    <?php $textnum = ($lang == 'th') ? convert($result1['total']) : Currency::bahtEng($result1['total']) ;  ?>
                                                      <?php echo $textnum ; ?>
                                                  </td>
                                              </tr>

                                        <tr class="active">
                                            <td>
                                                <p><b><?php echo $lang_activetime;?></b></p>
                                            </td>
                                            <td>
                                                <?php

                                                echo $result1['time'];
                                                ?>
                                            </td>
                                        </tr>
                                        <tr class="active">
                                            <td>
                                                <p><b><?php echo $lang_yoouripis;?></b></p>
                                            </td>
                                            <td>
                                                <?php echo $result1['ip']; ?>
                                            </td>
                                        </tr>

                                    </tbody>
                                </table>
                                

                            </div>
                        </div>
                        <div align="right"><?php echo $lang_vercheckpace." ". $tax; ?>&nbsp;&nbsp;&nbsp; <br>
                        <br></div>
                    </div>
                </div>


            </form>

    
    <?php include 'tags.php'; ?>

            <div class="well2">
            <br>
            <ul>
                <b><?php echo $lang_step_how ?></b>
                <li><?php echo $lang_inputname_usere ?> <b><?php echo $lang_name?></b></li>
                <li><?php echo $lang_money_loan ?> </li>
                <li><?php echo $lang_arr_inter?> </li>
                <li><?php echo $lang_lang_putbtt?></li>
            </ul>
        </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12 well well-lg">
            <?php include 'content.php'; ?>
        </div>
    </div>

    <div class="row">
    <div class="col-md-12 table-responsive" align="center">
        <h3 align="center"><?php echo $lang_recentinformation;?></h3>
        <table class="table table-striped">
        <thead class="bg-primary" align="center">
          <tr>
              <th>
                  <p align="center"><?php echo $lang_no;?></p>
              </th>
              <th>
                  <p align="center"><?php echo $lang_name;?></p>
              </th>
              <th>
                  <p align="center"><?php echo $lang_amount;?></p>
              </th>
              <th>
                  <p align="center"><?php echo $lang_withholdingtax;?></p>
              </th>

               <th>
                    <p align="center"><?php echo $lang_totaldeduction;?></p>
                </th>
              <th>
                  <p align="center"><?php echo $lang_taxs;?></p>
              </th>
              <th>
                  <p align="center"><?php echo $lang_interest; ?></p>
              </th>
              <th>
                  <p align="center"><?php echo $lang_activetime;?></p>
              </th>

              <th>
                  <p align="center"><?php echo $lang_yoouripis;?></p>
              </th>
              <th>
                  <p align="center"><?php echo $lang_showinformation;?></p>
              </th>
          </tr>
                </thead>


            <?php
            $sql = "SELECT * FROM tools_calculate_payment 
                        INNER JOIN tools_deduction ON tools_deduction.wht_no = tools_calculate_payment.wht 
                        where tools_calculate_payment.no ORDER BY no desc Limit 0,10 ";
                    $result2 = mysqli_query($conn, $sql);
                    while ($fetch = mysqli_fetch_assoc($result2)) {


            // $sql = "SELECT * FROM $data ORDER BY no desc Limit 0,10";
            // $result = mysqli_query($conn, $sql);
            // while ($fetch = mysqli_fetch_assoc($result)) {
                ?>

                <tr align="center">
                <td>
                        <?php echo $fetch['no']; ?>
                    </td>
                    <td>
                        <?php echo $fetch['name']; ?>
                    </td>
                    <td>
                        <?php echo number_format($fetch['money'], 2); ?>
                    </td>
                    <td>
                            <?php echo ($fetch['wht_name']); ?>
                        </td>

                        <td>
                            <?php echo number_format($fetch['totalwht'], 2); ?>
                        </td>

                    <td>
                        <?php echo number_format($fetch['tax'], 2); ?>
                    </td>

                    <td>
                        <?php echo number_format($fetch['total'], 2); ?>
                    </td>

                    <td>
                        <?php
                        echo  $fetch['time'];
                        ?>
                    </td>
                    <td>
                        <?php include 'ip.php'; ?>
                    </td>
                    <td>
                        <a href="showhome.php?no=<?php echo $fetch['no']; ?>&lang=<?php echo $lang; ?>">
                            <i class="glyphicon glyphicon-new-window"></i>
                        </a>
                    </td>
                </tr>
                <?php
            }
            ?>
        </table>

        <div class="text-center">
            	<nav aria-label="page navigation">
            		<?php echo $Pagination->parse(); ?>
            	</nav>

            </div>

        <input type="button" class="btn btn-primary" onclick="window.location = 'listhomeloan.php?lang=<?php echo $lang; ?>';" value="<?php echo $lang_seemore;?>">
    </div>

</div>
<?php include '../footer.php'; ?>
ภาพประจำตัวสมาชิก
eange08
PHP VIP Members
PHP VIP Members
โพสต์: 16015
ลงทะเบียนเมื่อ: 22/12/2020 10:09 am

Re: สอบถาม การดึงข้อมูลที่กรอกมาโชว์

โพสต์ที่ยังไม่ได้อ่าน โดย eange08 »

  • ใน input ตรงส่วน value ให้ใส่ส่วนที่เราดึงข้อมูลจาก $result1

โค้ด: เลือกทั้งหมด

 
<?php $no = $_REQUEST['no'];
        $sql1 ="SELECT * FROM tools_calculate_payment          
                INNER JOIN tools_deduction ON tools_deduction.wht_no = tools_calculate_payment.wht 
                where no = '".$no."'";
        $query1 = $conn->query($sql1);
        $result1 = mysqli_fetch_assoc($query1); ?>
  • ตัวอย่างดึงชื่อผู้ใช้งาน

โค้ด: เลือกทั้งหมด

<div class="input-group">
      <span class="input-group-addon alert-info" id="basic-addon1"><?php echo $lang_name;?></span>
      <input type="text" required name="name" class="form-control" autocomplete="off" placeholder="<?php echo $lang_enteryourname;?>" value="<?php echo $result1['name']; ?>"> <!--เปลี่ยนจาก <?php echo $dataname; ?> -->
</div>
hayatee
PHP Super Hero Member
PHP Super Hero Member
โพสต์: 670
ลงทะเบียนเมื่อ: 19/04/2021 10:01 am

Re: สอบถาม การดึงข้อมูลที่กรอกมาโชว์

โพสต์ที่ยังไม่ได้อ่าน โดย hayatee »

eange08 เขียน: 14/06/2021 4:36 pm
  • ใน input ตรงส่วน value ให้ใส่ส่วนที่เราดึงข้อมูลจาก $result1

โค้ด: เลือกทั้งหมด

 
<?php $no = $_REQUEST['no'];
        $sql1 ="SELECT * FROM tools_calculate_payment          
                INNER JOIN tools_deduction ON tools_deduction.wht_no = tools_calculate_payment.wht 
                where no = '".$no."'";
        $query1 = $conn->query($sql1);
        $result1 = mysqli_fetch_assoc($query1); ?>
  • ตัวอย่างดึงชื่อผู้ใช้งาน

โค้ด: เลือกทั้งหมด

<div class="input-group">
      <span class="input-group-addon alert-info" id="basic-addon1"><?php echo $lang_name;?></span>
      <input type="text" required name="name" class="form-control" autocomplete="off" placeholder="<?php echo $lang_enteryourname;?>" value="<?php echo $result1['name']; ?>"> <!--เปลี่ยนจาก <?php echo $dataname; ?> -->
</div>
ได้แล้วค่ะ ขอบคุณค่ะ
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: Bing [Bot] และบุคลทั่วไป 57