how to assign the html value to the php variable without post or get method
Posted
by
Meena
on Stack Overflow
See other posts from Stack Overflow
or by Meena
Published on 2011-03-14T08:00:32Z
Indexed on
2011/03/14
8:09 UTC
Read the original article
Hit count: 246
php
|JavaScript
hi , in my program i had a php value $test = 2 using this value i done some operation for example: in my page i had a 2 block A and B and one select box. If the test value is A it enable the div A, if the value is B it hide div A and also i am able to show and hide the div using the select box onchange event. please check my sample code given below
$test = $_GET["id"];
<select name="hideme" id="hideme" onchange="enableme();">
<option value="A">Show</option>
<option value="B">Hide</option>
</select>
if($test == 'A') {
<div id="div1" name="div1">
xxxxxxxxxxxxx
</div>
}
Js Function :
function enableme() {
if(document.getElementByID('hideme').value == "A") {
document.getElementById.style.display ="block";
} else {
document.getElementById.style.display ="none";
}
}
my issue is at fist time using the $test($_get) value it show the correct div but the on change event is not working because of , if condition. If i remove the if condition then it show div A even if the value of the $test is B. how could i handle both. Please Help me
© Stack Overflow or respective owner