Link to home
Start Free TrialLog in
Avatar of sabecs
sabecs

asked on

PHP variable - assign a value Using JavaScript

Hi,
How do I reload a page so that I can set a PHP variable?

The code below triggers when a checkbox is checked, I then need to reload the page to set a PHP variable.

function pickup(pickup){
            if (pickup.checked == 1){
            document.getElementById('showmessage').style.display = 'none';
            document.getElementById('showbuttons').style.display = 'inline';
            //code to reload page here and POST or GET a variable that I can pickup and assign using PHP

            }else {
            document.getElementById('showmessage').style.display = 'inline';
            }

}

Thanks in advance for your feedback.
ASKER CERTIFIED SOLUTION
Avatar of Shinesh Premrajan
Shinesh Premrajan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
window.location.href = "your page url";
Avatar of Justin Mathews
Justin Mathews

function pickup(pickup){
            if (pickup.checked == 1){
            document.getElementById('showmessage').style.display = 'none';
            document.getElementById('showbuttons').style.display = 'inline';
            //code to reload page here and POST or GET a variable that I can pickup and assign using PHP
            window.location.reload(true);

            }else {
            document.getElementById('showmessage').style.display = 'inline';
            }

}
Avatar of sabecs

ASKER

Thanks shinuq.