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".

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.