radiobutton-based menu selection

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a simple menu that is include()'d at the beginning of several php


one selection of which that I would like to assume the value of a
selected radio button on the page where it appears, so that when I select
that menu item, it will invoke another php script with the value of the
radio button, e.g.


The radio buttons are defined for each table row in the database SELECT
output, e.g.:

<td align=center><INPUT TYPE="radio" NAME="group" VALUE="<? echo "$id"; ?
Quoted text here. Click to load it

The menu item in menu.php is:

<td class="menu" bordercolor="black" id="choice3"
style="cursor:hand;background-color:aqua" onMouseOver="movein
(choice3,'Updates an entry')" onMouseOut="moveout(choice3)"
onClick="location.href='./update.php?ud_id=<? $_GET["group"]; ?>'">
<div align="center">Update</div>

where "group" is the name of the radio button group.

Can someone suggest how to make this work so that the value of ud_id in
the include()'d menu selection gets dynamically changed with the
different radio buttons in the script, please?

Re: radiobutton-based menu selection

<input type="radio" name="group" value="<?php echo($id); ?>">


Re: radiobutton-based menu selection

strawberry wrote:
Quoted text here. Click to load it
Maybe I am wrong but I think he is looking to have the the menu change
when the radiobutton is selected in real time.

If that is the case, you will be able to do that in PHP alone.

You will need to incorporate some client side scripting such as JavaScript.

PHP is server side and the only time is knows if something happened on
the browser is when the page (or frame) is sent to the server as a new
page call.


Re: radiobutton-based menu selection

On Sat, 27 Dec 2008 07:53:12 -0800, FutureShock wrote:

Quoted text here. Click to load it

Yes, that is the need.

Quoted text here. Click to load it

Of course, and thank you. The brain was even foggier than usual after
such a long day.

Re: radiobutton-based menu selection

Quoted text here. Click to load it

Hi Gregg,

Here's a basic working model for you to play around with, just change your
onclick event to point to the update() script and populate the radio button
values using php...


function update() {
var radio = document.update_form.elements['group'];
for (var i=0; i<radio.length; i++) {
if (radio[i].checked == true) {
radio =[i].value;
location.href = "./update.php?ud_id=" +radio;
// - End of JavaScript - -->


<form name="update_form">
<td align=center><INPUT TYPE="radio" NAME="group" VALUE="1"></td>
<td align=center><INPUT TYPE="radio" NAME="group" VALUE="2"></td>
<td align=center><INPUT TYPE="radio" NAME="group" VALUE="3"></td>
<td align=center><INPUT TYPE="radio" NAME="group" VALUE="4"></td>
<td align=center><INPUT TYPE="radio" NAME="group" VALUE="5"></td>

<a href="javascript: update();">TEST</a>


Re: radiobutton-based menu selection

Quoted text here. Click to load it

PS: If you would like the update to happen when you click one of the radio
buttons without using javascript then use this as an example...

<td align=center><INPUT TYPE="radio" NAME="group" VALUE="1"
onclick="location.href = './update.php?ud_id=' +this.value;"></td>

Hope this helps


Re: radiobutton-based menu selection

Andy wrote:
Quoted text here. Click to load it

Which is still javascript...

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline