Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I need help with this one. My checkbox value doesnt submit.
<input name="helicopter" type="checkbox" value="<?php echo $aircraft->helicopter; ?>" checked="<?php
if ($aircraft->helicopter==1) {
echo "checked";
}
?>"/>
Try this:
<input name="helicopter" type="checkbox" value="<?php echo $aircraft->helicopter; ?>"
<?php
if ($aircraft->helicopter==1) {
echo "checked";
}
?>>
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
What I want that there is a basic primary technology chekboxes. Now When I cheked on that chekboxes according to checkbox cheked it's feature technology display with the checkbox control.
This is My primary Technology chckbox code:-
<div class="form-group">
<label for="location" class="col-sm-4 control-label">TECHNOLOGIES</label><span style="color:red;margin-left:-307px;">*</span>
<div class="col-sm-6">
<?php if(#$aTechCount>0){
foreach( $aTechnology as $oType ){
?>
<li style="list-style-type:none;"><input type="checkbox" name="tech[]" onClick="return Validate_Check();" value="<?php echo #$oType->technology_id; ?>" id="tech"><?php echo strtoupper(#$oType->technology_name); } }?></li>
<span id="check_error" style="color:red;font-weight:bold;"></span></div>
</div>
</div>
You can do it with attaching an event to your checkboxes.
$('checkbox').change(function() {
if($(this).is(":checked")) {
//show your subcategory checkboxes for this checkbox
}
else{
//hide your subcategory checkboxes for this checkbox
}
});
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
first textfield should be disabled and when i clicked on check box, textfield should be active.
echo'<input type="checkbox" name="checkbox"/>';
echo'<textarea name="explain" id="explain"
cols="" rows="" style="width:300 ;height:300"></textarea>
if(isset($_POST['checkbox']))
{
???
}
I think you should use this:
<form>
<input type="checkbox" name="checkbox" onchange="toggleDisabled(this.checked)"/>
<textarea name="explain" id="explain"></textarea>
</form>
<script>
function toggleDisabled(checked) {
document.getElementById('explain').disabled = checked ? false : true;
}
</script>
Full code is here
Your question a little unclear. I've interpreted this as you needing JavaScript to set the textarea to disabled and active on a checkbox value without going to the server.
Using Javascript you can add an event listener on the checkbox and check the checked property, then set the textarea to disabled or not.
document.getElementById("checkbox").addEventListener("click", checkbox_textarea);
function checkbox_textarea() {
if( this.checked == true ) {
document.getElementById("textarea").disabled = false;
return false;
}
document.getElementById("textarea").disabled = true;
}
<input id=checkbox type=checkbox name=chk /> Enable text area <br />
<textarea id=textarea name=txt cols=50 rows=20 disabled></textarea>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Hello i want to check if the textarea isnt empty and i still can´t get the echo that i want even when the textarea isnt empty and input is set
here is my code:
<form method="post" action="">
<input type="text" name="jmeno"/>
<textarea name="textarea" id="textarea" rows="5" cols="40"></textarea>
<input type="submit" name="submit"/>
</form>
<?php
if(isset($_POST['jmeno']) AND !empty($_POST['textarea'])){
echo "dokončeno";
}
?>
How about this:
if (!is_null($_POST['jmeno']) && strlen(trim($_POST['jmeno'])) > 0) {
echo "dokončeno";
}
As far as I understand you want your code to check if the submit button is pressed and the textarea isn't empty. I would say the code is:
if(isset($_POST['jmeno'])){
if(strlen($_POST['textarea']) > 0){
echo "dokončeno";
}
}
OR simply:
if(isset($_POST['jmeno']) && strlen($_POST['textarea']) > 0){
echo "dokončeno";
}
if (isset($_POST['jmeno']) && strlen(trim($_POST['textarea']))>0)
{
echo "dokončeno";
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
<?php /* for loop starts */ ?>
<div>
<input name="cat[]" type="text" />
</div>
<?php /* for loop ends */ ?>
I want to display each value inside the input box if their POST variable is set.
try this bro :
i have a similar query like this.
<?php
$j = 0;
for($i = 1; $i<=8; $i++) {
?>
<tr>
<td style="width:50% !important;">
<input type="text" class="form-control" name="cat[]" value="<?php echo isset( $_POST['cat'][$j] ) ? $_POST['cat'][$j] : ''; ?>" />
</td>
</tr>
<?php $j++; } ?>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i have an if statement as follows
if($_POST['remember']=="on")
i want to know if this is the correct syntax for checking if the checkbox is checked or unchecked?
This code will help you
<input type="checkbox" name="checkbx" <?php if(isset($_POST['remember'])=="on") echo "checked";?> />
OR
<?php if(isset($_POST['remember'])=="on") {?>
<input type="checkbox" name="checkbx" checked="checked" />
<?php }else {?>
<input type="checkbox" name="checkbx" />
<?php }?>
simple check of isset
if(isset($_POST['remember']) && $_POST['remember']=="on")
{
// checkbox remember is checked
}
else
{
// checkbox remember is not checked
}
Use
if (isset($_POST['remember'])) {
// checked
} else {
not checked
}
<input type="checkbox" name="remember" value="YES" />
$remember= ($_POST['remember'] == 'YES')?'YES':'NO';