Radiobuttons to change variable value through php
I have a website which displays a chart based on data from a MySQL database.
The script that builds the chart is simply integrated in my webpage. An other script that queries the data from MySQL and puts it into the right format for the chartbuilder is situated in an external php file.
Now I want to do the following. I want to add radiobuttons to the webpage which can change the data that is plotted in the chart. What I have tried is that when somebody clicks on a radiobutton, I change the value of a specifi开发者_开发百科c variable (say; datarange). In the external php script I have some if-statements that relate to the datarange variable in order to determine what data to extract from the MySQL database.
The problem is that I cannot get the external php script to 'read' the value of "datarange" which is situated and being changed on the main page.
Is there any way to get this done? If not, any suggestions of getting it done?
Thanks a lot.
One way to solve this would be using AJAX. When one of your radiobuttons gets selected, you would send a new request to your php script including the new filter criteria and return the data for the new chart which you would have to update.
Spry Validation.
Run Index.php...
http://www.filedropper.com/radio
精彩评论