I need an assistance on how to transfer this value $row[COMPONENT]
in my class1.php into another page process_class.php with jQuery using post method.
i did this but it seems doesnt work ,
$('.cuttingCheckbox').change(function() {
if (this.checked) {
$.post('process_class.php',
{ comp : $($row[COMPONENT]).val(), comp_id : $($row[ID]).val() },
function(response) {
this.setAttribute("disabled", true), alert(comp,comp_id); });
}
});
Does anyone willing to help me ?
NoobEditor
16k20 gold badges85 silver badges117 bronze badges
asked Apr 14, 2014 at 6:58
1 Answer 1
you can save that $row[COMPONENT]
into session like this:
$_SESSION['row_component'] = $row[COMPONENT];
and in your next page, you just retrieve it:
$row = $_SESSION['row_component'];
As Jonast said (thanks dude), you should initiate the session first at the top of your php file: session_start();
answered Apr 14, 2014 at 10:47
Sign up to request clarification or add additional context in comments.
2 Comments
Jonast92
Message to OP: Make sure you got session_start(); at the top of every PHP page so that sessions will work. (It must appear before any output is sent to the browser from the server). That is, if you use this approach, which you should.
Chriskonz
@doniyor This is my implementation. and it still doesnt work even the alert... pastebin.com/mSVbF0fv pastebin.com/RS6Y1Ac3
default
ajax
for that. api.jquery.com/jQuery.ajax$('.cuttingCheckbox').change(function() { if (this.checked) { $.post('process_class.php', { comp : $($row[COMPONENT]).val(), comp_id : $($row[ID]).val() }, function(response){ this.setAttribute("disabled", true), alert(comp,comp_id); }); } });