Page 1 of 1
PHP Code
Posted: Mon Nov 13, 2006 5:49 am
by soumya_nht
How can I make a input field hidden by clicking on a radio button of the same page??
This is bugging me a lot
Plz Hlp
Posted: Mon Nov 13, 2006 5:53 am
by volka
You can use javascript to set the display attribute of that input field to hidden.
If you want to use php the client has to perform a complete new http request.
Posted: Mon Nov 13, 2006 11:30 pm
by califdon
Since I have seen several similar questions in this forum, maybe it's a good idea to make a point here:
PHP is server side programming. Once the page has been sent to the browser, there's no more PHP in it, so it can't possibly know anything about what the user is doing in the browser!
If you want to detect user interaction and perhaps take some action based on it, you have to use browser side programming that runs after the page is sent to the browser. That calls for Javascript of VBScript.
Posted: Mon Nov 13, 2006 11:59 pm
by aaronhall
Javascript can also make http requests to PHP scripts without the user experiencing a full page refresh by using the XMLHttpRequest object. It sounds like all you need though is to register a javascript onclick event to a function that sets the input's display property to hidden, as volka suggested.
Posted: Tue Nov 14, 2006 5:34 am
by impulse()
You could try
Code: Select all
if ($_GET["<radio button name">] == "<radio button>") {
echo "<input type = "hidden">";
}
Regards,