Question

In: Computer Science

How can I get res_ticket using php getstring? var post_data = "res_id=RYSEZ21786" + "&res_ticket=res8azjcfLQTHNU2mVtG" + "&pan="...

How can I get res_ticket using php getstring?

var post_data = "res_id=RYSEZ21786" +

"&res_ticket=res8azjcfLQTHNU2mVtG" +

"&pan=" + encodeURIComponent(document.getElementById('pan').value) +

"&pan_mm=" + encodeURIComponent(document.getElementById('exp_month').value) +

"&pan_yy=" + encodeURIComponent(document.getElementById('exp_year').value) +

"&cardholder=" + encodeURIComponent(document.getElementById('cardholder').value) +

avs_details +

cvd_details +

"&doTransaction=res_add";

Solutions

Expert Solution

HI,

I think you are asking to sendjavascript variable to php script to get the string "res_ticket=res8azjcfLQTHNU2mVtG"

There is two way to do this:

1. You can split the post_data varialb estring in javascript and can set it in html hidden feild from JS function and with you can get that res_ticket at php side by method $GET["res_ticket"]

like below

<script type="text/javascript">
    //pass your post_data variable in this javascript function
    function getstring(post_data) {
        var arr  = str.split("&");
        
        document.getElementById("res_ticket").value = arr[0];
    }
</script>

<form name="myform" action="" method="POST">
    <input type="hidden" name="res_ticket" id="res_ticket" />
</form>

<?php
   $res_ticket = $_POST['res_ticket']; // or by $_GET["res_ticket"]
   
   echo $query;
   
?>

Another way if you can set your javascript post_data variable to php file by above method and can parse string by php explode metthod like below

// string which can be long like your given string saperated by "&"
$post_data = "res_id=RYSEZ21786&res_ticket=res8azjcfLQTHNU2mVtG" ;


// pass delimiter and string to explode function.it will convert array of string
$post_data_arr = explode('&', $post_data);
// view result using var_dump..it will get the "res_ticket" string from array
var_dump($post_data_arr[1]);

Above are two way to sent javascript variable to php script..

Feel free to ask any question if you might have by comment box.

Thanks


Related Solutions

Using PHP and MYSQL and with a simple customer database, how can I create a simple...
Using PHP and MYSQL and with a simple customer database, how can I create a simple log in and registration system for an ecommerce site
How would I structure the following PHP (PDO) code into a table format using only PHP?...
How would I structure the following PHP (PDO) code into a table format using only PHP? //Our SQL statement, which will select a list of tables from the current MySQL database. $sql = "SELECT * FROM jobs"; //Prepare our SQL statement, $statement = $pdo->prepare($sql); //Execute the statement. $statement->execute(); //Fetch the rows from our statement. $tables = $statement->fetchAll(PDO::FETCH_NUM); //Loop through our table names. foreach($tables as $table){ //Print the table name out onto the page. echo $table[0], ' '; echo $table[1], '...
How can I get ATP and NADPH from DHAP using glycolysis and PPP?
How can I get ATP and NADPH from DHAP using glycolysis and PPP?
"How can I connect to Hadoop Hive using Python? I've tried using PyHive but always get...
"How can I connect to Hadoop Hive using Python? I've tried using PyHive but always get the error: ...could not start SASL... no mechanism available: unable to find a callback: 2"
When using scapy in python how can I get the same result as the snippit bellow?...
When using scapy in python how can I get the same result as the snippit bellow? (which in run in terminal) >>> sr(IP(dst="192.168.8.1")/TCP(dport=[21,22,23])) Received 6 packets, got 3 answers, remaining 0 packets (<Results: UDP:0 TCP:3 ICMP:0 Other:0>, <Unanswered: UDP:0 TCP:0 ICMP:0 Other:0>) >>> ans,unans=_ >>> ans.summary() IP / TCP 192.168.8.14:20 > 192.168.8.1:21 S ==> Ether / IP / TCP 192.168.8.1:21 > 192.168.8.14:20 RA / Padding IP / TCP 192.168.8.14:20 > 192.168.8.1:22 S ==> Ether / IP / TCP 192.168.8.1:22 >...
How can I make a PHP web app that will record student's names and grades? Req....
How can I make a PHP web app that will record student's names and grades? Req. A new table in our database called students. Table should include 2 columns; student_name and student_grade [0 - 100]. Need 3 PHP called student_list.php, add_student.php, and delete_student.php. The student_list.php code uses HTML and PHP to list all of the students in your student's table; including their student_name and student_grade [number grade] and letter grade. Convert the number grade to a letter grade as follows....
If i were to get the amount of heat transfer using constant pressure calorimetery, can I...
If i were to get the amount of heat transfer using constant pressure calorimetery, can I get the amount for the constant volume calorimetery using that value? Or vice versa?
2. Create a php program to get all the values from the forms using various methods...
2. Create a php program to get all the values from the forms using various methods and control structures like switch, if else, for, foreach, while, do while The question is required to write a program
I know the what the answers are but I don't know how to get them. Can...
I know the what the answers are but I don't know how to get them. Can you please explain the process? Thank you. Part VII. Discontinued Operations and Earnings per Share (11 points) Todd Corporation had pre-tax income for 2017 of $2,500,000. On December 31, 2017, Boyd disposed of a component of its business that represented a strategic shift in operation. That component had a Loss on Discontinued Operations of $450,000 (pre-tax). Boyd received $1,000,000 net cash proceeds from the...
I have a sequence of natural numbers. How can I get the height of the resulting...
I have a sequence of natural numbers. How can I get the height of the resulting tree/ c++(send code)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT