Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display pre defined variable after pressing radio-button

Status
Not open for further replies.

superprutser

Technical User
Nov 27, 2001
12
0
0
NL
Hi,

I am looking for a simple script that will display a predefined variable in <div> after pressing a radio button.

An example will do it for 2 different radio-buttons.

Can anyone help?

Thanks in advance.
 
Hi

What you explained so far would mean :
Code:
<input type="radio" onclick="document.getElementById('something').innerHTML='predefined'">

[gray]<!-- ... -->[/gray]

<div id="something"></div>

Feherke.
 
Thank you Feherke,

This helps a bit. What I wish to do is:
a predefined list, for example text1, text2, text3...

A set of radio buttons: button1, button2, button3...

Display on the page text1 if button1 is pressed, text2 if button2 is pressed, text3 if button3 is pressed...
If text1 is displayed and button2 is pressed then text1 has to be replaced with text2 (button2).

Maybe you can help me with this.

Thanks in advance.
 
Hi

Maybe this is closer ?
HTML:
<form action="php.php">
<input type="radio" name="whatever" value="button1"> One
<input type="radio" name="whatever" value="button2"> Two
<input type="radio" name="whatever" value="button3"> Three
<input type="submit">
</form>
Code:
<?php

$list=array('button1'=>'text1','button2'=>'text2','button3'=>'text4');
echo '<div>',$list[$_GET['whatever']],'</div>';

?>
However it is still not clear to me what you are trying to achieve.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top