html - How to fetch textbox value in radio button value in php -


i have 3 radio buttons in form. 2 of them have static values , 3rd 1 has radio button should have same value number entered in textbox. able fetch first 2 radio buttons values using $_post method on next page 3rd radio button, value null. please me textbox value 3rd radio button. code :

    <input type="radio" name="radio" value="500000" checked="checked" />purchase more 5 lakhs      <input type="radio" name="radio" value="2000000" />purchase more 20 lakhs      <input type="radio" name="radio" value="" />purchase more : <input type="text" name="radio" />  

if want solve using php, try approach:

<input type="radio" name="radio" value="500000" checked="checked" />purchase more 5 lakhs <input type="radio" name="radio" value="2000000" />purchase more 20 lakhs <input type="radio" name="radio" value="0" />purchase more : <input type="text" name="user_entered" /> 

in php file:

$result = $_post['radio']?$_post['radio']:$_post['user_entered']; 

this means: if radio set, use radio value; else use user_entered value.

of course, should further check if user_entered contains valid value, depending on requirements.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -