 |
|
คืออยากจะส่งค่าตัวแปรข้ามหน้าไปเรื่อยๆ อะค่ะ แบบนี้นะค่ะ
test1.php หน้าส่ง
//ajax
$(document).ready(function(){
$("#btn1").click(function(){
var txt = $("#text").val();
$.ajax({
url: "test2.php" +$('form1').serialize(),
type: "POST",
data : { Points: points,text : txt,name_img:'<?=$name_img?>'},
}).success(function(result) {
alert(result);
});
});
//$(this).prop('enabled', true);
});
test1.php ส่งข้ามหน้าไป test2.php
test2.php หน้ารับและส่งต่อไปหน้า test3.php
$text=$_POST['text'];
$Points1=$_POST["Points"];
$y1=(int)$Points1[1]['y'];
$y2=(int)$Points1[2]['y'];
$b1=$y1*2;
$b2=$y2*2;
$d = abs(($b1-$b2));
$a =$text/$d;
$scalval1=$a;
//ajax
$(document).ready(function(){
$("#btn1").click(function(){
$.ajax({
url: "test3.php" +$('form1').serialize(),
type: "POST",
data : { Points: points,scalval1:'<?=$scalval1?>',text:'<?=$text?>',name_img:'<?=$img_scale ?>'},
}).success(function(result) {
alert(result);
});
});
//$(this).prop('enabled', true);
});
test3.php รับจาก test2.php และส่งต่อไป test4.php
$scalval1=$_POST['scalval1'];
$text=$_POST['text'];
$Points=$_POST["Points"];
$y1=(int)$Points[1]['y'];
$y2=(int)$Points[2]['y'];
$b1=$y1*2;
$b2=$y2*2;
$d = abs(($b1-$b2));
$a =$text/$d;
$scalval2=$a;
//ajax
$(document).ready(function(){
$("#btn1").click(function(){
$.ajax({
url: "test4.php?" +$('form1').serialize(),
type: "POST",
data : { Points: points,scalval1:'<?=$scalval1?>',name_img:'<?=$img_scale?>',
scalval2:'<?=$scalval2?>',text:'<?=$text ?>'},
}).success(function(result) {
alert(result);
});
});
});
นี่แหละค่ะ คือว่าอยากให้ค่ามันส่งต่อไปเรื่อยๆ โดย points คือค่า input ที่เข้ามาให้แต่ละหน้า
และส่งไปคำนวณในอีกหน้าซึ่งจะได้เป็นค่า $scalval ปัญหาคือลอง alert ดูแล้วค่ามันไม่ยอมมา
อย่างเช่นค่า $scalval ในหน้า test2.php ไม่ยอมส่งมาหน้า test3.php ค่ะทำให้ส่งค่าไปเก็บใน db ไม่ได้
ใครพอทราบบ้างไหมค่ะ??? ลองงมแล้วแต่ก็ยังไม่ได้
ขอบคุณค่ะ 
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2015-03-24 18:30:23 |
By :
mimimi |
View :
879 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |