rilm Posted March 16, 2008 Share Posted March 16, 2008 <style TYPE="text/css"> .main { width:200px; border:1px solid black; } .month { background-color:black; font:bold 12px verdana; color:white; } .daysofweek { background-color:gray; font:bold 12px verdana; color:white; } .days { font-size: 12px; font-family:verdana; color:black; background-color: lightyellow; padding: 2px; } .days #today{ font-weight: bold; color: red; } .main { width:200px; border:1px solid black; } .month { background-color:black; font:bold 12px verdana; color:white; } .daysofweek { background-color:gray; font:bold 12px verdana; color:white; } .days { font-size: 12px; font-family:verdana; color:black; background-color: lightyellow; padding: 2px; } .days #today{ font-weight: bold; color: red; } #borderdraw { position: absolute; top:200px; left:600px; border-style: solid; border-width: 1px; width: 500px; height: 300px; line-height: 0px; } #scrol { position: absolute; top:530px; left:50px; }; #scroll { width: 1100px; height: 100px; background-color:gray; font-type: arial; font-size:10; overflow-x: scroll; overflow-y: auto;}; #teeltsoort { position:absolute; left:640px; top: 230px; } #teeltsoortedit { position:absolute; left:730px; top: 230px; } #verpakking { position:absolute; left:640px; top: 260px; } #verpakkingedit { position:absolute; left:730px; top: 260px; } #sortering { position:absolute; left:640px; top: 290px; } #sorteringedit { position:absolute; left:730px; top: 290px; } #aantal { position:absolute; left:640px; top: 320px; } #aantaledit { position:absolute; left:730px; top: 320px; } #verkoopprijs { position:absolute; left:640px; top: 350px; } #verkoopprijsedit { position:absolute; left:730px; top: 350px; } #zoekrecord { position:absolute; left:940px; top: 350px; } #zoekrecordedit { position:absolute; left:1040px; top: 370px; } </STYLE> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <script type="text/javascript" src="calendarDateInput.js"> /*********************************************** * Jason's Date Input Calendar- By Jason Moon http://calendar.moonscript.com/dateinput.cfm * Script featured on and available at http://www.dynamicdrive.com * Keep this notice intact for use. ***********************************************/ </script> <title></title> <?php function checkboxjes($id, $field, $first = '', $end = '') { $count = count($id); for ($i = 1; $i < $count; $i++) { $hack = strstr($id[$i], ";"); if($hack) { exit("ERROR: INVALID INPUT<br>". $hack ." IS NOT ALLOWED"); } else { if(!$hack) { $hack = " WHERE `". $field ."` = '". $id[$i] ."' "; } else { $hack .= "OR `". $field ."` = '". $id[$i] ."' "; } } $eind = $first.$hack.$end; return $eind; }} ?> </head> <body bgcolor="rgb(188,193,197)"> <?php include "verbinding.php"; ?> <form method="post" name="MyForm"> <h1 align="center"><font color="#8000ff" size="6">Faktuur 1.0</font></h1> <div id="borderdraw"></div> <div id="teeltsoort">Teeltsoort:</div> <div id="teeltsoortedit"> <input maxlength="40" name="teeltsoort"></div> <div id="verpakking">Verpakking:</div> <div id="verpakkingedit"> <input maxlength="40" name="verpakking"></div> <div id="sortering">Sortering:</div><div id="sorteringedit"> <input maxlength="40" name="sortering"> </div> <div id="aantal">Aantal:</div><div id="aantaledit"><input maxlength="10" name="aantal"></div> <div id="zoekrecord">Verwijder/Zoek record</div><div id="zoekrecordedit"> <input maxlength="4" name="wijzigrecord1" style="WIDTH: 30px; HEIGHT: 22px" size="3"></div> <div id="verkoopprijs">Verkoopprijs:</div><div id="verkoopprijsedit"><input maxLength="10" name="verkoopprijs"> <br>Leverdatum: <script> DateInput('orderdate', true, 'DD-MON-YYYY') </script></div> <input type="submit" id="submit3" value="Verwijder record" name="verwijder"> <input type="submit" id="submit1" value="Wijzig Huur" name="wijzighuurprijs"> <input type="submit" id="submit2" value="Wijzig record" name="wijzigrecord"> <input type="submit" id="submit" value="Voeg Record toe" name="voegtoe"> <?php ini_set ('display_errors', 1); error_reporting (E_ALL); include "verbinding.php"; mysql_select_db('offerte'); $query="SELECT * FROM faktuur"; $result=mysql_query($query) or die(mysql_error()); $num=mysql_numrows($result); echo "<div id=scrol><div id='scroll'> <b><center>Database Output</center></b><br><br>"; $i=0; while ($i < $num) { $first=mysql_result($result,$i,"teeltsoort"); $sec=mysql_result($result,$i,"faktuur_id"); echo "  "; // recordnummers echo "<b>$first <br>$sec"; echo "<input type='checkbox' name='check[]' value='check[".$sec."]'>"; $i++; } mysql_close(); ?> </div> </div> </form> <?php include "verbinding.php"; if (isset($_POST["voegtoe"])) { echo "voegtoe"; // html variabelen ophalen $naam = $_POST["teeltsoort"]; $boodschap = $_POST["verpakking"]; $database= "faktuur"; // variabele om het tijdstip van de boodschap in database op te slaan. $time= time(); // sql insert die je in de database gaat doen $sql=mysql_query("INSERT INTO faktuur(teeltsoort) VALUES ('".$naam."')")or die(mysql_error()); //uitvoeren van de query : mysql_query($sql); mysql_close($verbinding); } if (isset($_POST["verwijder"]) ) { include "verbinding.php"; $database="offerte"; mysql_select_db('offerte') or die( "Unable to select database"); if (isset($_POST["check"]) )//&& ctype_digit($_POST['check']) ) { for ($i=0; $i<count($_POST['check']);$i++) { $o= $_POST['check'][$i]; $check = implode(',',$_POST['check']); $faktuur='faktuur'; echo "<br />value $i = ".$_POST['check'][$i]; mysql_query("DELETE FROM faktuur WHERE faktuur_id = '".$i."'")or die( mysql_error());; // echo "gelukt"; } } //mysql_query ( $sql1 );// } elseif (isset($_POST["wijzighuurprijs"])) { echo "wijzighuurprijs"; } elseif (isset($_POST["wijzigrecord"])) { $record = $_POST["wijzigrecord1"]; echo "wijzigrecord", $record; // sql insert die je in de database gaat doen $sql=mysql_query("SELECT teeltsoort FROM faktuur WHERE faktuur_id = $record")or die(mysql_error()); //uitvoeren van de query : $rec=mysql_fetch_assoc($sql); echo '<div id="teeltsoortedit"> '; echo '<input maxlength="40" name="teeltsoort" value="'.$rec['teeltsoort'].'"></div>'; // echo "{$rec['teeltsoort']}"; } elseif (isset($_POST[""])){} ?> </body> </html> sorry for the long code, it gives no error and it gives the right record number from my database through the checkboxes but its not deleting.it says check[9] so the record number 9 is the record i clicked for delete. thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.