Jump to content

Ronel

Members
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Ronel

  • Rank
    Member
  1. Dear Sir/Madame I am trying to insert comments into a table called comments using echo ID in the input form but so far i can insert the comments with the post id but unable re-comment again kindly help me what do i do? This is the input form: <div> <form action="ehscomment.php" method="post"> <input type="hidden" name="id" value="<?php echo $id ?>"> <div> <label>Add comment</label> <div> <textarea rows="6" cols="110" name="comment" placeholder="comment"></textarea> </div> </div> <input type="submit" name="postcomment" value="comment"></form> </div> And this is ehscomment.php <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "registration"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } if(isset($_POST['postcomment'])){ $id = $_POST['id']; $comment = $_POST['comment']; $sql = "INSERT INTO comments (id,comment) VALUES ('$id','$comment')"; if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } $conn->close();} ?> Error message: Error: INSERT INTO comments (id,comment) VALUES ('242','asddd') Duplicate entry '242' for key 'PRIMARY'
  2. Ronel

    php insert

    okay sir now after i have properly name the input file in the form field and it works good thank you so much.
  3. Ronel

    php insert

    <?php session_start(); if (!isset($_SESSION['username'])) { $_SESSION['msg'] = "You have to log in first"; header('location: login.php'); } if (isset($_GET['logout'])) { session_destroy(); unset($_SESSION['username']); header("location: login.php"); } ?> <?php $host="localhost"; $username="root"; $pass=""; $db="registration"; $conn=mysqli_connect($host,$username,$pass,$db); if(!$conn){ die("Database connection error"); } // insert query for register page if(isset($_POST['ronel'])){ $image = $_FILES['file']['name']; $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["file"]["name"]); // Select file type $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); // Valid file extensions $extensions_arr = array("jpg","jpeg","png","gif","pdf"); // Check extension if( in_array($imageFileType,$extensions_arr) ) { $details=$_POST['details']; $location=$_POST['location']; $checkbox=$_POST['checkbox']; $injured=$_POST['injured']; $agegender=$_POST['agegender']; $contact=$_POST['contact']; $empid=$_POST['empid']; $dept=$_POST['dept']; $organization=$_POST['organization']; $summary=$_POST['summary']; $name=$_POST['name']; $outcome=$_POST['outcome']; $cause=$_POST['cause']; $action=$_POST['action']; $reportedname=$_POST['reportedname']; $position=$_POST['position']; $organisation=$_POST['organisation']; $reportedcontact=$_POST['reportedcontact']; $reporteddept=$_POST['reporteddept']; $status="Pending"; $comment=$_POST['comment']; $query="INSERT INTO `proposals` (`details`,`location`,`date`,`time`,`checkbox`,`injured`,`agegender`,`contact`,`empid`,`dept` ,`organization`,`summary`,`image`,`outcome`,`cause`,`action`,`reportedname`,`position`,`organisation`,`reportedcontact`,`reporteddept`,`status`,`comment`) VALUES ('$details','$location', current_timestamp(),current_timestamp(),'$checkbox','$injured','$agegender','$contact','$empid','$dept' ,'$organization','$summary','$name','$outcome','$cause','$action','$reportedname','$position','$organisation','$reportedcontact','$reporteddept','$status','$comment')"; $res=mysqli_query($conn,$query); if($res){ $_SESSION['success']="Not Inserted successfully!"; header('Location:'); }else{ echo "<script>alert('Proposal not applied!');</script>"; } // Upload file move_uploaded_file($_FILES['file']['tmp_name'],$target_dir.$image); } } date_default_timezone_set("Asia/Kolkata"); ?> <html> <body style="background-color:F8FFFF;"> <table style="position:absolute; bottom:83.2%; left:226px; width:66.3%; height:16.5%;"> <tr> <th style="font-weight:600; font-size:18px">ONGC TRIPURA POWER COMPANY LIMITED</th> </tr> <tr> <td style="font-weight:600; font-size:18px">INITIAL EHS INCIDENT REPORT FORM OTPC/SOP/EHS/001/R1</td> </tr> </table> <div class="container"> <img src="otpc1" alt="Paris" style="width:130px; height:75px; border: 1px solid #ddd; border-radius: 4px; position: relative; left: 85%; bottom:17px; padding: 10px;"> <img src="otpc" alt="Paris" style="width:170px; height:75px; border: 1px solid #ddd; border-radius: 4px; position: relative; right:140px; bottom:16px; padding: 15px;"> </div> <div class="col-xs-6 col-xs-push-3 well"> <form class="form-horizontal" method="post" action="" enctype="multipart/form-data"> <input type="hidden" name="ronel" value=""> <fieldset style="position:relative; width:95%; top:0px; left:10px;"> <legend>NEW PROPOSAL NO.</legend> <!----left box-----------> <!----right box-----------> <div class="col-xs-9"> <div class="form-group"> <label for="inputEmail" class="col-lg-3" style="font-size:16px;color:black;"><b>Details of Incident:</b></label><br> <div class="col-lg-9"> <textarea rows="5" cols="110" name="details" class="form-control" maxlength="1000" onkeyup="textCounter(this,'counter4',1000);"></textarea><br><input style="position:absolute; left:75.3%; top:102px;" disabled maxlength="3" size="3" value="1000" id="counter4"> </div> </div><br> <fieldset style="position:relative; width:73.05%; height:50px; border:1px solid gray;"> <div class="form-group" style="position:relative; left:80px; top:-8px;"> <label style="position:relative; right:80px; top:25px;" for="inputEmail" class="col-lg-3"><b>Location:</b></label> <div class="col-lg-9"> <textarea name="location" class="form-control" rows="2" cols="56" maxlength="100" onkeyup="textCounter(this,'counter5',100);"></textarea><input style="position:absolute; left:54%; bottom:0px;" disabled maxlength="3" size="2" value="100" id="counter5"> </div> </div> <div class="form-group" style="position:absolute; left:638px; bottom:22px;"> <label style="position:relative; right:58px; top:20px;" for="inputEmail" class="col-lg-3"><b>Date:</b></label> <div class="col-lg-9"> <textarea style="position:relative; top:0px;right:19%;" cols="10" rows="1" disabled><?php echo date('Y-m-d'); ?> </textarea> </div> </div> <div class="form-group" style="position:relative; left:780px; bottom:54px;"> <label style="position:relative; right:67px; top:20px;" for="inputEmail" class="col-lg-3"><b>Time:</b></label> <div class="col-lg-9"> <textarea style="position:relative; top:0px;right:3%;" cols="10" rows="1" disabled><?php date_default_timezone_set("Asia/Kolkata"); echo date("h:i:sa"); ?> </textarea> </div> </div> </fieldset> <br> <div class="form-group"> <label for="inputEmail" class="col-lg-3" style="font-size:16px;color:black;"><b>Classification(Tick the appropriate one, Leave blank if you find it difficulty):</b></label> <div class="col-lg-9" name="checkbox"> <table> <tr> <th>Nearmisscase</th> <th>First Aid Case</th> <th>Lost Time Injury</th> <th>Fatal</th> <th>Fire</th> <th>Emission/Discharge/Spill/Leak(Abnormal)</th> <th>Property Damage</th> <th>HIPO</th> </tr> <tr> <td><input type="checkbox" value="Nearmiss case" name="checkbox"></td> <td><input type="checkbox" value="First Aid Case" name="checkbox"></td> <td><input type="checkbox" value="Lost Time Injury" name="checkbox"></td> <td><input type="checkbox" value="Fatal" name="checkbox"></td> <td><input type="checkbox" value="Fire" name="checkbox"></td> <td><input type="checkbox" value="Emission/Discharge/Spill/Leak(Abnormal)" name="checkbox"></td> <td><input type="checkbox" value="Property Damage" name="checkbox"></td> <td><input type="checkbox" value="HIPO" name="checkbox"></td> </tr> </table> <style> table { font-family: sans-serif; border-collapse: collapse; width: 75.5%; font-size: 15px; } td, th { border: 1px solid black; text-align: center; padding: 2px; font-weight: normal; } </style> </div> </div> <br> <div class="form-group"> <label for="inputEmail" class="col-lg-3" style="font-size:17px;color:black;"><b>Details of Injured :</b></label> <br> <label for="inputEmail" class="col-lg-3"><b>Name:</b></label> <div class="col-lg-9"> <textarea name="injured" cols="25" rows="1" class="form-control"></textarea> </div> </div> <div class="form-group" style="position:relative; left:20%; bottom:39px;"> <label for="inputEmail" class="col-lg-3"><b>Age/Gender:</b></label> <div class="col-lg-9"> <textarea name="agegender" class="form-control" cols="3" rows="1"></textarea> </div> </div> <div class="form-group" style="position:relative; left:29%; bottom:78px;"> <label for="inputEmail" class="col-lg-3"><b>Contact:</b></label> <div class="col-lg-9"> <textarea name="contact" class="form-control" cols="9" rows="1"></textarea> </div> </div> <div class="form-group" style="position:absolute; left:1.2%; top:26.5%;"> <label for="inputEmail" class="col-lg-3"><b>Employee ID:</b></label> <div class="col-lg-9"> <textarea name="empid" class="form-control" cols="3" rows="1"></textarea> </div> </div> <div class="form-group" style="position:relative; left:39%; bottom:117px;"> <label for="inputEmail" class="col-lg-3"><b>Organization:</b></label> <div class="col-lg-9"> <input type="text" name="organization" class="form-control"> </div> </div> <div class="form-group" style="position:absolute; left:55%; bottom:74%;"> <label for="inputEmail" class="col-lg-3"><b>Department:</b></label> <div class="col-lg-9"> <select name="dept" class="form-control"> <option value="">---------Select Dept--------</option> <option value="MMD">MMD</option> <option value="O&M">O&M</option> <option value="Civil">Civil</option> <option value="C&M">C&M</option> <option value="Logistics">Logistics</option> <option value="HR & ADMIN">HR & ADMIN</option> <option value="Fire & Safety">Fire & Safety</option> <option value="IT & MIS">IT & MIS</option> <option value="F&M">F&M</option> <option value="EMD">EMD</option> <option value="C&I">C&I</option> <option value="STORE">STORE</option> <option value="EHS">EHS</option> <option value="Tech Cell">Tech Cell</option> <option value="Operation">Operation</option> <option value="Chemist">Chemist</option> </select> </div> </div><br><br> <div class="form-group"> <label for="inputEmail" class="col-lg-3" style="position:relative; bottom:90px; font-size:17px;color:black;"><b>Summary Of Incident:</b></label> <div class="col-lg-9" style="position:relative; bottom:90px;"> <textarea rows="8" cols="110" name="summary" class="form-control" maxlength="1000" onkeyup="textCounter(this,'counter3',1000);"></textarea><br><input style="position:absolute; left:72.5%;" disabled maxlength="3" size="3" value="1000" id="counter3"> </div> </div> <div class="form-group"> <label style="position:absolute; left:63%; top:425px;" for="inputEmail" class="col-lg-3"><b>Upload Images Here :</b></label><br><br> <div class="col-lg-9"> <input style="position:absolute; left:78%; top:420px;" type="file" name="file" enctype="multipart/form-data" class="form-control" name="incident_reference" onchange="document.getElementById('inc_ref').src = window.URL.createObjectURL(this.files[0]); document.getElementById('inc_ref').className +='_active'; document.getElementById('inc_ref_span').className += '_hidden'"> </div><iframe id="inc_ref" class="form-group" width="220px" height="130px" style="position:absolute; left:78%; top:32%;"></iframe> </div> <div class="form-group"> <label for="inputEmail" class="col-lg-3" style="position:relative; bottom:110px; font-size:17px;color:black;"><b>Potential outcome(Incase of Near Miss case or Potential Incident only):</b></label> <div class="col-lg-9" style="position:relative; bottom:110px;"> <textarea rows="8" cols="110" name="outcome" class="form-control" maxlength="1000" maxlength="1000" onkeyup="textCounter(this,'counter2',1000);"></textarea><br><input style="position:absolute; left:76%; top:102px;" disabled maxlength="3" size="3" value="1000" id="counter2"> </div> </div><br> <div class="form-group"> <label for="inputEmail" class="col-lg-3" style="position:relative; bottom:110px; font-size:17px;color:black;"><b>Likely Cause:</b></label> <div class="col-lg-9" style="position:relative; bottom:110px;"> <textarea rows="8" cols="110" name="cause" class="form-control" maxlength="1000" maxlength="1000" onkeyup="textCounter(this,'counter1',1000);"></textarea><br><input style="position:absolute; left:76%; top:102px;" disabled maxlength="3" size="3" value="1000" id="counter1"> </div> </div><br> <div class="form-group"> <label for="inputEmail" class="col-lg-3" style="position:relative; bottom:110px; font-size:17px;color:black;"><b>Immediate Action:</b></label> <div class="col-lg-9" style="position:relative; bottom:110px;"> <textarea rows="8" cols="110" name="action" class="form-control" maxlength="1000" onkeyup="textCounter(this,'counter',1000);"></textarea><br><input style="position:absolute; left:76%; top:102px;" disabled maxlength="3" size="3" value="1000" id="counter"> </div> </div><br> <div class="form-group"> <label for="inputEmail" class="col-lg-3" style="position:relative; bottom:110px; font-size:17px;color:black;"><b>Incident reported by:</b></label> <label for="inputEmail" class="col-lg-3" style="position:relative; bottom:80px; right:160px;"><b>Name:</b></label> <div class="col-lg-9"> <input style="position:absolute; bottom:230px; left:10px;" type="text" name="reportedname" class="form-control"> </div> </div> <div class="form-group" style="position:relative; left:15%; bottom:100px;"> <label for="inputEmail" class="col-lg-3"><b>Position:</b></label> <div class="col-lg-9"> <input type="text" name="position" class="form-control"> </div> </div> <div class="form-group" style="position:relative; left:31%; bottom:141px;"> <label for="inputEmail" class="col-lg-3"><b>Organisation:</b></label> <div class="col-lg-9"> <input type="text" name="organisation" class="form-control"> </div> </div> <div class="form-group" style="position:relative; left:0%; bottom:130px;"> <label for="inputEmail" class="col-lg-3"><b>Contact:</b></label> <div class="col-lg-9"> <input type="text" name="reportedcontact" class="form-control"> </div> </div> <div class="form-group" style="position:relative; left:175px; bottom:171px;"> <label for="inputEmail" class="col-lg-3"><b>Department:</b></label> <div class="col-lg-9"> <input type="text" name="reporteddept" class="form-control"> </div> </div> <div class="col-lg-9"> <input type="hidden" name="status" class="form-control"> </div> <div class="form-group"> <label for="inputEmail" class="col-lg-3"><b></b></label> <div class="col-lg-9"> <input type="hidden" name="comment" class="form-control"> </div> </div> </div> </fieldset> <br> <script type="text/javascript"> function confSubmit(form) { if (confirm("Are you sure you want to submit the form?")) { form.submit(); } else { alert("You decided to not submit the form!"); } } </script> <script> function textCounter(field, field2, maxlimit) { var countfield = document.getElementById(field2); if (field.value.length > maxlimit) { field.value = field.value.substring(0, maxlimit); return false; } else { countfield.value = maxlimit - field.value.length; } } </script> <div class="form-group" style="position:absolute; left:33px;"> <div class="col-lg-12"> <button class="button1" type="reset" class="btn btn-default">Cancel</button> <button class="button1" type="submit" class="btn btn-primary" onClick="confSubmit(this.form);">Submit</button> <style> .button1:hover { background-color: #555555; color: aqua; border: 3px solid grey; } </style> </div> </div> </form> </div> </body> </html> Dear Sir this is the whole post and the full input fields. Kindly show some light. Error Message: Notice: Undefined index: name in /opt/lampp/htdocs/create-nearmiss.php on line 57
  4. Ronel

    php insert

    no sir the line is 40 not line 57 because i haven't posted the codes from the top. Sorry. The exact line is $name=$_POST['name']; and i cannot seem to find the error!! kindly help.
  5. Ronel

    php insert

    Not being able to upload images in the directory with a path name in the database? 1) This is my code for insert into the database and directory: <?php $host="localhost"; $username="root"; $pass=""; $db="registration"; $conn=mysqli_connect($host,$username,$pass,$db); if(!$conn){ die("Database connection error"); } // insert query for register page if(isset($_POST['ronel'])){ $images = $_FILES['file']['name']; $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["file"]["name"]); // Select file type $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); // Valid file extensions $extensions_arr = array("jpg","jpeg","png","gif","pdf"); // Check extension if( in_array($imageFileType,$extensions_arr) ) { $details=$_POST['details']; $location=$_POST['location']; $checkbox=$_POST['checkbox']; $injured=$_POST['injured']; $agegender=$_POST['agegender']; $contact=$_POST['contact']; $empid=$_POST['empid']; $dept=$_POST['dept']; $organization=$_POST['organization']; $summary=$_POST['summary']; $name=$_POST['name']; $outcome=$_POST['outcome']; $cause=$_POST['cause']; $action=$_POST['action']; $reportedname=$_POST['reportedname']; $position=$_POST['position']; $organisation=$_POST['organisation']; $reportedcontact=$_POST['reportedcontact']; $reporteddept=$_POST['reporteddept']; $status="Pending"; $comment=$_POST['comment']; $query="INSERT INTO `proposals` (`details`,`location`,`date`,`time`,`checkbox`,`injured`,`agegender`,`contact`,`empid`,`dept` ,`organization`,`summary`,`image`,`outcome`,`cause`,`action`,`reportedname`,`position`,`organisation`,`reportedcontact`,`reporteddept`,`status`,`comment`) VALUES ('$details','$location', current_timestamp(),current_timestamp(),'$checkbox','$injured','$agegender','$contact','$empid','$dept' ,'$organization','$summary','$name','$outcome','$cause','$action','$reportedname','$position','$organisation','$reportedcontact','$reporteddept','$status','$comment')"; $res=mysqli_query($conn,$query); if($res){ $_SESSION['success']="Not Inserted successfully!"; header('Location:'); }else{ echo "<script>alert('Proposal not applied!');</script>"; } // Upload file move_uploaded_file($_FILES['file']['tmp_name'],$target_dir.$image); } } date_default_timezone_set("Asia/Kolkata"); ?> 2) Here is the input file: <form class="form-horizontal" method="post" action="" enctype="multipart/form-data"> <input type="hidden" name="ronel" value=""> <div class="form-group"> <label style="position:absolute; left:63%; top:425px;" for="inputEmail" class="col-lg-3"><b>Upload Images Here :</b></label><br><br> <div class="col-lg-9"> <input style="position:absolute; left:78%; top:420px;" type="file" name="file" enctype="multipart/form-data" class="form-control" name="incident_reference" onchange="document.getElementById('inc_ref').src = window.URL.createObjectURL(this.files[0]); document.getElementById('inc_ref').className +='_active'; document.getElementById('inc_ref_span').className += '_hidden'"> </div><iframe id="inc_ref" class="form-group" width="220px" height="130px" style="position:absolute; left:78%; top:32%;"></iframe></div> </form> 3) error code: Notice: Undefined index: name in /opt/lampp/htdocs/create-nearmiss.php on line 57 ONGC TRIPUR
  6. Ronel

    PHP update

    Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables in /opt/lampp/htdocs/new1/ronel_detail.php on line 15 Fatal error: Uncaught mysqli_sql_exception: No data supplied for parameters in prepared statement in /opt/lampp/htdocs/new1/ronel_detail.php:16 Stack trace: #0 /opt/lampp/htdocs/new1/ronel_detail.php(16): mysqli_stmt->execute() #1 {main} thrown in /opt/lampp/htdocs/new1/ronel_detail.php on line 16 This is the error it gave me!
  7. Ronel

    PHP update

    <?php mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = mysqli_connect("localhost","root", "","update"); // // PROCESS POSTED DATA // if ($_SERVER['REQUEST_METHOD']=='POST') { $stmt = $conn->prepare("UPDATE ronel SET status = ?, comment = ?, department = ? WHERE id = ? "); $stmt->bind_param('ssi', $_POST['status'], $_POST['comment'], $_POST['department'], $_POST['id']); $stmt->execute(); header("Location: ronel_dashboard.php"); exit; } if (!isset($_GET['id']) || trim($_GET['id'])=='') { header("Location: "); exit; } $res = $conn->prepare("SELECT id , location , status , comment , department FROM ronel WHERE id = ? "); $res->bind_param('i', $_GET['id']); $res->execute(); $res->bind_result($id, $location, $status, $comment, $department); $res->fetch(); $res->close(); // // status-dependent processing // $buttons = "<div class='data'> <button name='status' class='w3-button w3-khaki' value='$status'>Update</button> </div> "; ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-language" content="en"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Details</title> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <style type='text/css'> body { font-family: calibri, sans; font-size: 12pt; } label { display: inline-block; width: 150px; background-color:#E4EBC5; color:orangered; padding: 8px; font-weight: 600; margin-right:30px; vertical-align: top;} .data { display: inline-block; width: 500px; padding: 8px; vertical-align: top;} /*.comment { display: inline-block; width: 450px; vertical-align: top;} */ </style> </head> <body> <header class="w3-display-container w3-orange w3-padding" style='height:90px;'> <div class="w3-left"> <h2>Details</h2> </div> <div class="w3-right w3-margin"> <a href='ronel_dashboard.php' class='w3-khaki w3-button'>Dashboard</a> </div> </header> <div class='w3-container'> <form method='POST'> <input type='hidden' name='id' value='<?=$id?>'> <div class="w3-card w3-padding" style='max-width: 750px; margin: 30px auto;'> <div> <label>ID</label> <div class="data"><?=$_GET['id']?></div> </div> <div> <label>Location</label> <div class="data"><?=$location?></div> </div> <div> <label>Status</label> <div><?=$status?></div> </div> <div> <label>Comments</label> <div class="data"><textarea name='comment' class='w3-input w3-border' rows='5'><?=$comment?></textarea></div> </div> <div><label for="cars">Select Department:</label> <div class="data"> <select id="department"> <option value="volvo">MMD</option> <option value="saab">O&M</option> <option value="opel">Civil</option> <option value="audi">C&M</option> </select> </div> </div> </div> <div class='w3-content w3-center w3-padding'> <?=$buttons?> </div> </form> </div> </body> </html> Dear Sir/Madame Can someone help me with this piece of code? I have tried updating a comment section with approve and reject status button here and Sir Barand has helped me a lot with the project code which he provided me!! Now after the approval/reject part done what i am trying to do is update a department section with the comment section as well and instead of approve/reject button i want to update only with a different page.
  8. Sir it says= <?php $conn = mysqli_connect("localhost","root", "","update"); // // Check if data was posted for processing // if ($_SERVER['REQUEST_METHOD']=='POST') { $stmt = $conn->prepare("UPDATE ronel SET status = ? WHERE id = ? "); $stmt->bind_param('si', $_POST['status'], $_POST['id']); $stmt->execute(); header("Location: #"); // reload the page exit; } $pendingRecs = ''; $res = $conn->query("SELECT id , details , location , status , comment FROM ronel WHERE status = 'Pending' ORDER BY date, time "); if ($row = $res->fetch_assoc()) { do { $pendingRecs .= " <form method='post'> <input type='hidden' name='id' value='{$row['id']}'> <tr> <td>{$row['id']}</td> <td>{$row['details']}</td> <td>{$row['location']}</td> <td>{$row['status']}</td> <td>{$row['comment']}</td> <td><button name='status' value='Approved' class='w3-button w3-green'>Approve</button></td> <td><button name='status' value='Rejected' class='w3-button w3-red'>Reject</button></td> <textarea name='comment' cols='50' rows='5'><?=$comment?></textarea> </tr> </form> "; } while ($row = $res->fetch_assoc()); } else { $pendingRecs = "<tr><td colspan='7'>No Pending records</td></tr>" ; } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-language" content="en"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Dashboard</title> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <style type='text/css'> body { font-family: calibri, sans; font-size: 12pt; } </style> </head> <body> <header class="w3-container w3-orange w3-padding w3-center"> <h2>Dashboard</h2> </header> <div class="w3-content w3-padding"> <table class="w3-table w3-bordered"> <tr style="background-color:#E4EBC5; color:orangered;"> <th>ID</th> <th>Details</th> <th>Location</th> <th>Status</th> <th>Comment</th> <th colspan="2">Action</th> </tr> <?=$pendingRecs?> </table> </div> </body> </html> Notice: Undefined variable: comment in /opt/lampp/htdocs/new1/view.php on line 44
  9. Thanks a lot. Sir it is working now but one more trouble sir and that is i need to put a comment text box with the approve and reject button!!
  10. Sir lets say i don't want to show the details,date and time, in the dashboard only status,id,location and comment with a click button on its side to view the full details. Now, when i click the full details button it href me to another page and shows me the full details? How do i that here with the same code or do i need to change anything in order to achieve it??
  11. Sir what if i want to display the data from the database with a link and when i click on the link shows the whole database on the other page? The whole status comment and details all? can it be possible? please help me out with this ! <body> <h2 style="text-align:center; color:orangered;"> DASHBOARD </h2> <table> <h3> <tr style="background-color:#E4EBC5; color:orangered;"> <th>ID</th> <th>Details</th> <th>Location</th> <th>Status</th> <th>Comment</th> </tr> </h3> </table> <?Php //////////////////////////////////////////// require "dbconfig.php"; // MySQL connection string $count="SELECT id,details,location,status,comment FROM ronel"; if($stmt = $connection->query($count)){ while ($nt = $stmt->fetch_assoc()) { echo " <body> <table> <tr> <td><a href=view.php?id=$nt[id]>$nt[id]/$nt[department]</a></td> <td>$nt[id]</td> <td>$nt[details]</td> <td>$nt[location]</td> <td>$nt[status]</td> <td>$nt[comment]</td> </tr> </table> </body> "; } }else{ echo $connection->error; } ?>
  12. great help from you thank you a ton sir you made my day awesome i have been trying these for days!! i cannot thank you enough .
  13. Sir this is my dbconfig.php <?php $connection = mysqli_connect("localhost","root", "","update"); ?>
×
×
  • 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.