Dear ,

We have an billing script when we enter value on the submition page it will create an recipt number and other details
we have entered in the form on the page recipt.php that was the first code. Past year the script was working fine but
now it was showing us an error in the concole of our browser " Uncaught SyntaxError: Unexpected token ;"

We don't know what to do or how to resolve this isse in the recipt.php page was are pushing customer mobile number

and an message to tsms.php we have included our both codes below if any one can help that will be a greate help
for us as because of this issue the billing process are stopped completely so please help ..

our recipt.php which will show recipt details and also trigger sms to tsms.php

<?php
header('Access-Control-Allow-Origin: *');
include '../includes/MysqlConnect.php';
include 'includes/AuthWeb.php';
$result = Utils_AuthWeb::isLoggedIn();
if (!$result) {
    header('Location: ../index.php');
}
$con = MysqlConnect::getInstance();

$today =  date('Y-m-d'); 

if( isset($_GET['c_id']) || isset($_GET['s_id']) || isset($_GET['p_id']))
    {  
    $customer_id = $_GET['c_id']; 
    $cus_scheme_id = $_GET['s_id'];  
    $payment_id = $_GET['p_id'];  

            $check_scheme_exist =$con->select("select * from `cus_scheme` where `customer_id` = '$customer_id' AND `cus_scheme_id` = '$cus_scheme_id' ",false);

            if( empty($check_scheme_exist) ){  
            //header("location:a_manage_payment.php"); 
            }else{    

                $scheme_payment = $con->select("select * from `payment` where `payment_id`='$payment_id' ",false);
                if(!empty($scheme_payment)){
                $scheme_payment_receipt_no = $scheme_payment['p_receipt_no'];
                $_SESSION['receipt_no'] = $scheme_payment_receipt_no;
                $scheme_payment_date = $scheme_payment['p_paid_date'];
                $scheme_payment_name = $scheme_payment['customer_id'];
                $scheme_payment_name = $con->select("select * from `customer` where `customer_id` = '$scheme_payment_name' ",false);
                if(empty($scheme_payment_name)){ header("location:a_manage_payment.php"); }else{  
                $scheme_payment_fname = $scheme_payment_name['fullname'];
                $scheme_payment_amount = $scheme_payment['p_amount'];
                //$scheme_payment_weight = $scheme_payment['p_gold_weight'];
                //$scheme_payment_gold_rate = $scheme_payment['current_gold_rate'];
                $sPayment = $con->select("select count(*) as tot from `payment` where `cus_scheme_id` = '$cus_scheme_id' ",false);
                $countIns = $sPayment['tot']; 
                $mobile = $scheme_payment_name['phone_1'];
                $messages  = "Dear ".$scheme_payment_fname.", Receipt NO:".$scheme_payment_receipt_no." payment received KWD: ".$scheme_payment_amount." Thanks"; 

                }

                }else{
                    //header("location:a_manage_payment.php"); 
                }

            }

    }

        else{ 
        header("location:s_apsearch.php");
    }

?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Receipt</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <meta content="CRM" name="description" />
        <meta content="ABCD" name="author" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />

        <!-- App favicon -->
        <link rel="shortcut icon" href="assets/images/favicon.ico">

         <!-- Plugins css-->
        <link href="../plugins/bootstrap-tagsinput/css/bootstrap-tagsinput.css" rel="stylesheet" />
        <link href="../plugins/bootstrap-select/css/bootstrap-select.min.css" rel="stylesheet" />
        <link href="../plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="../plugins/switchery/switchery.min.css">

        <!-- App css -->
        <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="assets/css/icons.css" rel="stylesheet" type="text/css" />
        <link href="assets/css/metismenu.min.css" rel="stylesheet" type="text/css" />
        <link href="assets/css/style.css" rel="stylesheet" type="text/css" />

        <script src="assets/js/modernizr.min.js"></script>

       <base href="http://rjatlasjewellery.com/kwcrm/staff/s_receipt.php">

    </head>

    <body>

        <!-- Begin page -->
        <div id="wrapper">

            <!-- ========== Left Sidebar Start ========== -->
            <?php include 'includes/staff_admin_sidebar.php'; ?>
            <!-- Left Sidebar End -->

            <!-- ============================================================== -->
            <!-- Start right Content here -->
            <!-- ============================================================== -->

            <div class="content-page">

                <!-- Top Bar Start -->
                <div class="topbar">

                    <nav class="navbar-custom">

                        <?php include 'includes/staff_admin_header.php'; ?>

                        <ul class="list-inline menu-left mb-0">
                            <li class="float-left">
                                <button class="button-menu-mobile open-left disable-btn">
                                    <i class="dripicons-menu"></i>
                                </button>
                            </li>
                            <li>
                                <div class="page-title-box">
                                    <h4 class="page-title">Customer Recipt</h4>
                                    <!--<ol class="breadcrumb">
                                        <li class="breadcrumb-item"><a href="dashboard.php">Home</a></li>
                                        <li class="breadcrumb-item"><a href="#">Manage Payments</a></li>
                                        <li class="breadcrumb-item active">Receipt</li>
                                    </ol>-->
                                </div>
                            </li>

                        </ul>

                    </nav>

                </div>
                <!-- Top Bar End -->

                <!-- Start Page content -->
                <div class="content">
                    <div class="container-fluid">

                        <div class="row">
                            <div class="col-12">

                            <?php if(isset($sucess)){ echo $sucess; } ?>
                            <?php if(isset($error)){ echo $error; } ?>
                                <div class="card-box">
                                   <!-- <h4 class="m-t-0 header-title">Hello</h4>-->

                          <!--          <p class="text-muted m-b-30 font-14">
                                       Customer Recipt
                                    </p>-->

                                    <div class="row">
                                        <div class="col-10">
                                            <div class="p-20" id="printdiv">
                                            <style type="text/css">
    input[type=text]
    {
        border: 0px;
        background: transparent;
        width:auto;
    }
        /*print {
    font-size: 25px;
}*/
@media print {
   body { font-size: 60pt } /*Print screen Font size */
 }
 @media screen {
   body { font-size: 14px }
 }
 @media screen, print {
   body { line-height: 1 }
 }
</style>

                                            <h4><print><input type="text" placeholder="Shop name" required=""> </input></print></h4>
                                            <print><input type="text" placeholder="Address" required=""></print><br>
                                            <print><input type="text" placeholder="Phone number" required=""></print>

                                                <form class="form-horizontal" role="form" method="post" > 

                                                    <div class="form-group row">
                                                        <label class="col-2 col-form-label" ><print>Receipt No</print></label>
                                                            <div class="col-6">
                                                                <label class="col-6 col-form-label" ><print><?php echo ": ".$scheme_payment_receipt_no; ?></print></label>
                                                            </div>
                                                    </div>

                                                    <div class="form-group row">
                                                        <label class="col-2 col-form-label" ><print>Name</label>
                                                            <div class="col-6">
                                                                <label class="col-6 col-form-label" ><print><?php echo ": ".$scheme_payment_fname; ?></print></label>
                                                            </div>
                                                    </div>
                                                     <div class="form-group row">
                                                        <label class="col-2 col-form-label" ><print>Reg No</print></label>
                                                            <div class="col-6">
                                                                <label class="col-6 col-form-label" ><print><?php echo ": ".$customer_id; ?></print></label>
                                                            </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-2 col-form-label" ><print>Date</label>
                                                            <div class="col-6">
                                                                <label class="col-6 col-form-label" ><print><?php echo ": ".$scheme_payment_date; ?></print></label>
                                                            </div>
                                                    </div>

                                                   <!--<div class="form-group row">
                                                        <label class="col-6 col-form-label" >Today's Gold Rate</label>
                                                            <div class="col-6">
                                                                <label class="col-6 col-form-label" ><print><?php //echo ": ".$scheme_payment_gold_rate; ?></label>
                                                            </div>
                                                    </div>-->
                                                 <div class="form-group row">
                                                        <label class="col-2 col-form-label" ><print>Amount Paid</print></label>
                                                            <div class="col-6">
                                                                <label class="col-6 col-form-label" ><print><?php echo ": ".$scheme_payment_amount; ?></print></label>
                                                            </div>
                                                    </div>
                                                    <!--<div class="form-group row">
                                                        <label class="col-6 col-form-label" >Weight</label>
                                                            <div class="col-6">
                                                                <label class="col-6 col-form-label" ><b><?php //echo ": ".$scheme_payment_weight; ?></b></label>
                                                            </div>
                                                    </div>-->
                                                    <div class="form-group row">
                                                        <label class="col-2 col-form-label" ><print>Installment</print></label>
                                                            <div class="col-6">
                                                                <label class="col-6 col-form-label" ><print><?php echo ": ".$countIns; ?></print></label>
                                                            </div>
                                                    </div>
                                                     <div class="form-group row">
                                                        <label class="col-2 col-form-label" ><print>Mobile</print></label>
                                                            <div class="col-6">
                                                                <label class="col-6 col-form-label" ><print><?php echo ": ".$mobile; ?></print></label>
                                                            </div>
                                                    </div>

                                                    </div>

                                                </form>

                                            </div>
                                        </div>
<div class="form-group row">

                                                            <div class="col-12">
                   <a href="dashboard.php"><button type="button" class="btn btn-info waves-effect waves-light"> <i class="fa fa-cloud m-r-5"></i> <span>Go Home</span> </button></a>

                    <a href="s_apsearch.php"><button type="button" class="btn btn-purple waves-effect waves-light"> <span>Pay Another</span> <i class="icon-paypal"></i> </button></a>

   <button type="button" class="btn btn-purple waves-effect waves-light" id="print" onclick="printContent('printdiv');" > <span>Print</span> <i class="icon-paypal"></i> </button>

<script>
function printContent(el){
var restorepage = $('body').html();
var printcontent = $('#' + el).clone();
$('body').empty().html(printcontent);
window.print();
$('body').html(restorepage);
}
</script>
                                                            </div>
                                    </div>
                                    <!-- end row -->

                                </div> <!-- end card-box -->
                            </div><!-- end col -->
                        </div>
                        <!-- end row -->
                        <!----start row-->

                    </div> <!-- container -->

                </div> <!-- content -->

              <!----------------admin footer  ------------------>
               <?php include 'includes/admin_footer.php'; ?>
        <!----------------/admin footer  ------------------>

            </div>

            <!-- ============================================================== -->
            <!-- End Right content here -->
            <!-- ============================================================== -->

        </div>
        <!-- END wrapper -->

        <!-- jQuery  -->
        <script src="assets/js/jquery.min.js"></script>
        <script src="assets/js/popper.min.js"></script>
        <script src="assets/js/bootstrap.min.js"></script>
        <script src="assets/js/metisMenu.min.js"></script>
        <script src="assets/js/waves.js"></script>
        <script src="assets/js/jquery.slimscroll.js"></script>

        <script src="../plugins/switchery/switchery.min.js"></script>
        <script src="../plugins/bootstrap-tagsinput/js/bootstrap-tagsinput.min.js"></script>
        <script src="../plugins/select2/js/select2.min.js" type="text/javascript"></script>
        <script src="../plugins/bootstrap-select/js/bootstrap-select.js" type="text/javascript"></script>
        <script src="../plugins/bootstrap-filestyle/js/bootstrap-filestyle.min.js" type="text/javascript"></script>
        <script src="../plugins/bootstrap-maxlength/bootstrap-maxlength.js" type="text/javascript"></script>

        <script type="text/javascript" src="../plugins/autocomplete/jquery.mockjax.js"></script>
        <script type="text/javascript" src="../plugins/autocomplete/jquery.autocomplete.min.js"></script>
        <script type="text/javascript" src="../plugins/autocomplete/countries.js"></script>

        <!-- App js -->
        <script src="assets/js/jquery.core.js"></script>
        <script src="assets/js/jquery.app.js"></script>

        <!-- SMS SENDING SCRIPT START -->

        <script type="text/javascript">

            $(document).ready(function(){
                var name = <?php if(isset($_SESSION['customer_name'])){ echo $_SESSION['customer_name']; unset($_SESSION['customer_name']); } ?>;
                var mobile = <?php if(isset($_SESSION['customer_mobile'])){ echo $_SESSION['customer_mobile']; unset($_SESSION['customer_mobile']); } ?>;
                var amount = <?php if(isset($_SESSION['p_amount'])){ echo $_SESSION['p_amount']; unset($_SESSION['p_amount']); } ?>;
                var receipt_no = <?php if(isset($_SESSION['receipt_no'])){ echo $_SESSION['receipt_no']; unset($_SESSION['receipt_no']); } ?>;
                var message ="Dear "+name+", Receipt NO:"+receipt_no+", payment received KWD: "+amount+", Thanks"; 
                $.ajax({
                         type:"post",
                         url:"tsms.php",
                         data:{ message:message , mobile:mobile },
                         success:function(data){
                            console.log(data);
                         }

                });

            });

        </script>

               <!-- SMS SENDING SCRIPT END --> 

    </body>
</html>

tsms.php SMS PHP CODE

<?php

include '../includes/MysqlConnect.php';
include 'includes/AuthWeb.php';
$result = Utils_AuthWeb::isLoggedIn();

$con = MysqlConnect::getInstance();

    if( (isset($_POST['message'])) && (isset($_POST['mobile'])) )
    {
        $message  = $_POST['message'];
        $mobile = $_POST['mobile'];
        $key = "566551225c8eb1cacbc642bfd747";

 header("Location:http://sms.abcdefg.com/rest/services/sendSMS/sendGroupSms?AUTH_KEY=566551225c8eb1cacbc642bfd747&message=$message&senderId=ABCDEF&routeId=1&mobileNos=$mobile&smsContentType=english");

?>

So please help me it was too urgent

Recommended Answers

All 3 Replies

I don't see it but there are hundreds of lines of code here. You as the author, developer or maintainer need to narrow it down to the line that is throwing this error.

https://www.google.com/search?q=Uncaught+SyntaxError%3A+Unexpected+token+%3B%22&gl=US finds it's a very common error but to work out what it is, we find the line and if it's a call to a method or function we dump the variables in the call to see if we can see why the call complains.

I'd use any of the outputs noted at https://www.w3schools.com/js/js_output.asp to show these variables.

I have spend hours to resolve this issue but didn't got any answer from google that's why I have posted this here if your know how to resolve help me

@annya. Then it's old school debugging. I take it you didn't get any line number or full line of text on the error. This means you get to go old school on the problem. That is, insert some output to a log file or screen (I supplied a link how) so you can track down what line is failing.

Using any of the output methods at https://www.w3schools.com/js/js_output.asp you place (psuedo-code here) lines where you suspect it failing like this: console.log("At line 100"). Eventually you find the line that fails and either you see the issue or have to log the variables on the line to see why it complains.

It's work but something a programmer does when the script doesn't show a line number or content when it fails.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.