onClick

Discussion in 'JavaScript' started by zodiac, Dec 15, 2009.

  1. #1
    this is just the form part of it.it checks all the boxes.
    is document.checkfiles.checkbox[] right?
    can it have the brackets in checkbox[] or the coding wrong?

    echo '<form name="checkfiles" action="broken_files.php" method="POST" >';
    $query = mysql_query("select id, title, thumbnail, file from games") or die(mysql_error());
    while($row = mysql_fetch_array($query)) {
    	if (!file_exists('../' . $row['thumbnail'])) {
    		
    	    echo $row['id'] . '';
    	echo '
        <a href="manage_game.php?edit=' . $row['id'] . '">Edit</a>
    	<input type="checkbox" name="checkbox[]" value="'.$row['id'].'">
    <br />';
    
     
     }
    	}
    	 echo' 
    	 <input type="submit" value="delete" />
    	 <input type="button" name="CheckAll" value="Check All" onClick="checkAll(document.checkfiles.checkbox[])">
    		
    </form>';
    PHP:
     
    zodiac, Dec 15, 2009 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    what you do is not going to work in scripting (reference to array of inputs that way)

    something like this?
    http://mooshell.net/K5Cbc/
     
    dimitar christoff, Dec 15, 2009 IP
  3. AlexKey

    AlexKey Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I suggest to use jQuery javascript framework. It is lightweight and easy to use. With jQuery your problem can be solved like this:
     
    AlexKey, Dec 15, 2009 IP