I have two radio button that are value 0 and 1 stored in mysql database after that i want to enable(when value is =1) or disable(when value is =0) button. i new to php please give me code for that some thing like that...
<input type="submit" ... <?php&nbs
p;if (/* condition not met */)
echo "disabled='disabled'" ?>">
Web_2
0
Newbie Poster
Recommended Answers
Jump to PostIf you're posting the value of the radio to a different page, you might be over-complicating it by over-thinking it.
Page 2:
<?php // Posted value from Page 1 $radio_value = $_POST['radio_element']; if($radio_value == 0) { <button type="button" disabled>You can't click me!</button> } else { <button type="button">Click …
Jump to PostUsing what the guys have said about obtaining the
$radio
variable:Solution to your version
<input name="xyz" <?php if($radio == 0){echo "disabled='disabled'";} ?> />
Neater version
<?php $input = "<input name='xyz'"; if($radio == 0) { $input .= " disabled='disabled'"; } $input .= …
All 7 Replies
Ketul_1
-6
Junior Poster
Web_2
0
Newbie Poster
Ketul_1
-6
Junior Poster
Web_2
0
Newbie Poster
DJBirdi
54
Junior Poster
mattster
195
Practically a Master Poster
Featured Poster
Web_2
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.