Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting 0 value in below variables :-
"
$order_ID
,
$user_ID
,
$course_ID
.
When I try to debug, I always get null in these above variables.
I have also started session, but still I get zero value in these variable.

What I have tried:

pgResponse.php

.........................
...........................
............................
............................


if($isValidChecksum == "TRUE") 
{
	echo "Checksum matched and following are the transaction details:" . "<br/>";
	if ($_POST["STATUS"] == "TXN_SUCCESS") 
	{
		echo "<center>Payment is successfull.</center>" . "<br/>";
		

		if(isset($_POST['ORDERID'] , $_POST['TXNAMOUNT']))
		{
			
			session_start();
			
			$order_ID=$_POST['ORDERID'];
			$user_ID=$_SESSION['userID'];
			$course_ID=$_POST['hiddenCourseID'];
			$status=$_POST['STATUS'];
			$response_msg=$_POST['RESPMSG'];
			$Amt=$_POST['TXNAMOUNT'];
			$order_date=$_POST['TXNDATE'];
			$transactionID=$_POST['TXNID'];
			$paymentMode=$_POST['PAYMENTMODE'];
			$gatewayName=$_POST['GATEWAYNAME'];
			$bankTransactionID=$_POST['BANKTXNID'];
			$bankName=$_POST['BANKNAME'];

			require_once("../include/DB.php");
			
			try
			{
				$Query="INSERT INTO tbl_sales_order(orderID,
													courseID,
													userID,
													status,
													responseMsg,
													Amount,
													orderDate,
													transactionID,
													paymentMode,
													gatewayName,
													bankTransactionID,
													bankName) 
							                 VALUES('$order_ID',
											 		'$course_ID',
													 '$user_ID',
													 '$status',
													 '$response_msg',
													 '$Amt',
													 '$order_date',
													 '$transactionID',
													 '$paymentMode',
													 '$gatewayName',
													 '$bankTransactionID',
													 '$bankName')";
				//Prepare the SQL statement.
				$cmd= $pdoObj->prepare($Query);
				if($cmd->execute())
				{
					
					echo"<script>setTimeout(()=>window.location.href='../index.php';},1400)</script>";
				}
				else
				{
					//redirects the user to same page
					
				}


			}
			catch (PDOException $ex)
			{
				//error in connecting db
				$connectionErrorMsg=$ex->getMessage();
				echo "Error in connecting to database...:" .$connectionErrorMsg;
				echo "<script>alert('Error in connecting to database...')</script>";
			}

		}
	}
	else 
	{
		echo "<center>Transaction failed.</center>" . "<br/>";
	}

	if (isset($_POST) && count($_POST)>0 )
	{ 
?>
		<center><table border="1" cellspacing="0" style="background-color: cornflowerblue;">
<?php
		foreach($_POST as $paramName => $paramValue) 
		{
?> 			<tr>
				<td><?php echo $paramName; ?> </td><td><?php echo $paramValue; ?></td>;
			</tr>
<?php
		}
?>
		</table></center>
<?php
	}
	

}
else 
{
	echo "Checksum mismatched.";
	//Process transaction as suspicious.
}





=====================================================================================
checkout.php
<?php
    //PREVENT navigation to previous page after logout
    if(isset($_SESSION)==false)
    {
        session_start();
    }
    if(!isset($_SESSION['isStudentLoggedIn']))//prevent unauthorized access to checkout module
    {
        //redirect the logged user to login/registration page
        echo "<script>window.open('login_registration.php','_self')</script>";
    }
    else
    {
        header("Pragma: no-cache");
        header("Cache-Control: no-cache");
        header("Expires: 0");
        //store logged in student in session
        include_once('include/crud.php');
        list($retrievedUserName,$retrievedUserImagePath,$retrievedEmail)=crud::getUserData($_SESSION['userID']);

?>
        <!DOCTYPE html>
        <html lang="en">

        <head>
            ..........................
            ..........................

        </head>
        <body>
            <div class="page-wraper">
                <div id="loading-icon-bx"></div>
                <!-- Header Top ==== -->
                    <?php include_once('include/header.php');?>
                <!-- Header Top END ==== -->
                <!-- Content -->
                <div class="container" id="product-section" style="margin-top: 5%;">
                    <h1>Checkout</h1>
                    <form method="post" action="PaytmKit/pgRedirect.php">
                        <table border="0" class="table table-sm">
                        <tbody>
                            
                            <tr>
                                
                                <td><label>ORDER_ID:*</label></td>
                                <td><input id="ORDER_ID" tabindex="1" maxlength="20" size="20"
                                    name="ORDER_ID" autocomplete="off" 
                                    value="<?php echo  "ORDS" . rand(10000,99999999)?>" style="border: none;">
                                </td>
                            </tr>
                            <tr>
                                
                                <td><label>CUSTOMER ID(USER ID) :*</label></td>
                                <td><input id="CUST_ID" tabindex="2" maxlength="12" size="12"  name="CUST_ID" autocomplete="off" value="<?=$_SESSION['userID']?>" style="border: none;"></td>
                            </tr>
                            <tr>
                                
                                <td><label>INDUSTRY_TYPE_ID :*</label></td>
                                <td><input id="INDUSTRY_TYPE_ID" tabindex="4" maxlength="12" size="12"  name="INDUSTRY_TYPE_ID" autocomplete="off" value="Retail" style="border: none;"></td>
                            </tr>
                            <tr>
                                
                                <td><label>Channel :*</label></td>
                                <td><input id="CHANNEL_ID" tabindex="4" maxlength="12" 
                                    size="12" name="CHANNEL_ID" autocomplete="off" value="WEB"  style="border: none;">
                                </td>
                            </tr>
                            <tr>
                                
                                <td><label>Transaction Amount* (₹)</label></td>
                                <td><input title="TXN_AMOUNT" tabindex="10" 
                                    type="text" name="TXN_AMOUNT"
                                    value="<?php echo $_POST['hiddenDiscountedPrice'] ?>"  style="border: none;">
                                </td>
                            </tr>
                            <tr>
                               
                                <td></td>
                                <td>
                                    <input value="Proceed to Pay" class="btn btn-bg-primary" type="submit" onclick="" name="btnProceedToPay">
                                    <a href="index.php" style="margin-left: 20%;color: grey;">Cancel</a>
                                </td>
                            </tr>
                        </tbody>
                        </table>
	                </form>
                </div>
                <!-- Content END-->
                <!-- Footer ==== -->
                    <?php include_once('include/footer.php'); ?>
                <!-- Footer END ==== -->
            </div>

            <!-- External JavaScripts -->
            <script src="assets/js/jquery.min.js"></script>


            <script src="assets/vendors/bootstrap/js/popper.min.js"></script>

            <script src="assets/vendors/bootstrap/js/bootstrap.min.js"></script>


            <script src="assets/vendors/bootstrap-select/bootstrap-select.min.js"></script>

            <script src="assets/vendors/bootstrap-touchspin/jquery.bootstrap-touchspin.js"></script>

            <script src="assets/vendors/magnific-popup/magnific-popup.js"></script>

            <script src="assets/vendors/counter/waypoints-min.js"></script>

            <script src="assets/vendors/counter/counterup.min.js"></script>

            <script src="assets/vendors/imagesloaded/imagesloaded.js"></script>

            <script src="assets/vendors/masonry/masonry.js"></script>

            <script src="assets/vendors/masonry/filter.js"></script>

            <script src="assets/vendors/owl-carousel/owl.carousel.js"></script>


            <script src="assets/js/functions.js"></script>

            <script src="assets/js/contact.js"></script>
        </body>
    </html>
<?php
    }
?>
<?php
    if(isset($_POST['btnAddtoCart']))
    {
        $courseID=$_POST['hiddenCourseID'];
        echo "<script>alert('Course id='+$courseID)</script>";
    }

?>
Posted
Updated 9-Feb-21 3:59am

1 solution

In your PHP code you have

PHP
$order_ID=$_POST['ORDERID'];

And in the HTML you have
HTML
<td><input id="ORDER_ID" tabindex="1" maxlength="20" size="20"

So the two identities do not match.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900