Jump to content

How to change text input name with radio buttons?


davocold

Recommended Posts

Here is the text input box:

<input type="text" name="english" onkeyup="transcrire()"

id="pfc_words"

title="<?php echo _pfc("Enter your message here"); ?>"

maxlength="<?php echo $max_text_len; ?>"/>

 

I have the following radio buttons:

<input type="radio" name="language" value="" checked onClick="french();"/><label for="language">French </label> <input type="radio" name="language" value="" onClick="english();"/> <label for="language">English </label>

 

i need a function to change the name of the text input "english" depending on the radio button selected. if the first radio button is selected i want the text input name set to "french" and if the second radio button is selected i want text input name set to "english".

I believe you should post this in the javascript forum.

But if you only need this info for processing use the values in the language radio set. set one to french and the other to english, and check it when the form is submitted. $_POST['language'] will then tell you which it is.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.