Jump to content

ElChoco

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ElChoco's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. OH! well duh, I feel just stupid.  ::) I've been looking at this for much too long to not have noticed that. Thank you. Everything works now, it submits to another page. I do love this forum! ;D
  2. Oops, yeah. Thanks. What I know, is that the function is being called, but $checkbox isn't set correctly. If I put an echo in there nothing prints. [code]  <?php   if (isset($_POST["checked"]))   {     foreach ($_POST["checked"] as $checkbox)     {       echo '$checkbox';   $sql="update searchresults set view='0' WHERE count = '$checkbox'";       mysql_query($sql);     }   }    ?>[/code] Do I have my array messed up? Thanks again. This is a great forum.
  3. I would like to 'hide' selections based on ticked checkboxes. I'm running into a bit of trouble though. I have the select all, de-select all buttons working but when I try to change the table for all those clicked it fails.  ??? It hurts my brains, all of them. Thanks [code]<?PHP session_start(); // This connects to the existing session $username = $_SESSION['username']; $password = $_SESSION['password']; if (!isset($username) || !isset($password)) {     header( "Location: http://www.bedwettingstore.com/login.php?login=fail" ); } /********************************* ** The Welcome Table and logout ** *********************************/ ?> <table width="100%"><tr><td align="left">Welcome <font face="Verdana, Arial, Helvetica, sans-serif" size="3"><b><?=$username?></b></font></td><td align="right"><a href="logout.php">Log Out</a></td></tr></table><br /><br /> <?PHP /****************** ** DB Variables  ** ******************/ $dbhost = "###.###.###.###"; $dbuser = "username"; $dbpass = "password"; $dbname = "dbname"; /********************** **  Connect to DB  ** **********************/ global $link; $link = mysql_connect("$dbhost","$dbuser","$dbpass"); mysql_select_db("$dbname",$link)or die( "Unable to select database".mysql_error()); // Get All Fields from table $query="SELECT * FROM searchresults where view=\"1\""; $result=mysql_query($query); // Count number of (different) data $num = mysql_numrows($result); //Close Connection //mysql_close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script type="text/javascript" language="javascript"> /*********************************/ /*** CHECK or UnCHECK all boxes **/ /*********************************/ <!-- var form='checkboxForm' //Give the form name here function SetChecked(val,chkName) { dml=document.forms[form]; len = dml.elements.length; var k=0; for( k=0 ; k<len ; k++) { if (dml.elements[k].name==chkName) { dml.elements[k].checked=val; } } } function deleteRecords(checkbox) { <?php   if (isset($_POST["checked"]))   {     foreach ($_POST["checked"] as $checkbox) {       $sql="update searchresults set view='0'";       mysql_query($sql);     }   }    ?> } // --> </script> </head> <body> <a href="javascript:SetChecked(1, 'checked[]')">Check All</a> &nbsp; <a href="javascript:SetChecked(0, 'checked[]')">Un-Check All</a> &nbsp; <a href="javascript:deleteRecords('checked[]')">Delete Records</a> <form name="checkboxForm" method="post" action="#" onSubmit="return ValidateForm(this, 'checked')"> <table border="1"><tr><td align="center">&nbsp;</td><td align="center" width="12">#</td><td align="center">Date & Time</td><td align="center">Search Query</td><td align="center">Page</td></tr> <? $i=0; while ($i < $num) { $id=mysql_result($result,$i,"count"); $datetime=mysql_result($result,$i,"datetime"); $search=mysql_result($result,$i,"search"); $page=mysql_result($result,$i,"page"); ?> <tr><td><input type="checkbox" name="checked[]" value="<?=$id?>" > <td align=\"center\"><?=$id?></td><td align=\"center\"><?=$datetime?></td><td align="center"><?=$search?></td><td align="center"><?=$page?></td></tr> <?PHP $i++; } ?> </table> </form> </body> </html> [/code]
×
×
  • 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.