Jump to content

Checkbox automatic check


rugzo

Recommended Posts

Hi all,

 

I have a question about the checkbox.

I have an input field in my form.

 

<input type="file" name="box>

 

and i have a checkbox

 

<input type="checkbox" name ="checkbox">

 

i want that the checkbox is automatically checked when a file for upload is selected. Can anyone help me with that. I tried something like

if(isset($_POST['box']);"checkbox value";"1");

but had no success.

 

thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/152803-checkbox-automatic-check/
Share on other sites

I tried something -->

<script language="javascript">

 

function isaretle()

 

{

 

form2.box.checked=true ;

 

}

 

</script>

-------------

<input type="file" name="dosya" onKeyDown="isaretle()"><br />

    <input type="checkbox" name="box">

 

If i type someting into the input field 'dosya', the code works and the box is checked automatically. But if i click on browse to select a file the box remains uncheck and this is what i need.

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.