Jump to content

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.

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.