Newbie: help with javascript+PHP interactions
Posted: Mon Jul 14, 2003 5:41 pm
Hello all,
I'm new to both javascript and PHP and am having trouble seeing the "big
picture". I thought I had it down but I added some javascript and am now
lost conceptually.
I'm building menus dynamically via javascript, and would like to pass on
the current values of these menus to a PHP script which creates an image
for me (a graph of the values).
Normally I would do something like this:
which works fine when the page is first loaded ($query_string is given
default values). However the intent is for the user to change the menus'
values, hit "submit" again and the image will be recreated.
How do I do that so the image is recreated in the correct place when the
user hits the "submit" button or changes a menu selection? That is, I can
do something like this:
so that when the user changes a selection, "CallGraph()" is called which
is a javascript function that builds the $query_string to pass to graph1.php.
However I'm lost as to what to do next. How do I simply call graph1.php from
within CallGraph() so that the image will appear in the proper place??
You can view the code at http://www.mindspring.com/~jc416975/stacked.html for reference.
(NOTE: Other applications this script depends on aren't running currently so
you get errors if you hit the actual button). This is the html that stacked.php creates,
which also creates the javascript you see in stacked.html.
Thanks for any pointers, it's greatly appreciated.
I'm new to both javascript and PHP and am having trouble seeing the "big
picture". I thought I had it down but I added some javascript and am now
lost conceptually.
I'm building menus dynamically via javascript, and would like to pass on
the current values of these menus to a PHP script which creates an image
for me (a graph of the values).
Normally I would do something like this:
Code: Select all
<form action="graph1.php?$query_string" name=form7 method=post>
<input type="submit" value="Send form">
</form>default values). However the intent is for the user to change the menus'
values, hit "submit" again and the image will be recreated.
How do I do that so the image is recreated in the correct place when the
user hits the "submit" button or changes a menu selection? That is, I can
do something like this:
Code: Select all
<form action="stacked.php" name=form7 method=post onSubmit="return false;">
<select name="Table" onchange="CallGraph()">
<option selected=true value="spacekeeper">Table</option>
</select>
</form>is a javascript function that builds the $query_string to pass to graph1.php.
However I'm lost as to what to do next. How do I simply call graph1.php from
within CallGraph() so that the image will appear in the proper place??
You can view the code at http://www.mindspring.com/~jc416975/stacked.html for reference.
(NOTE: Other applications this script depends on aren't running currently so
you get errors if you hit the actual button). This is the html that stacked.php creates,
which also creates the javascript you see in stacked.html.
Thanks for any pointers, it's greatly appreciated.