Jump to content

JohnCharves

New Members
  • Posts

    2
  • Joined

  • Last visited

JohnCharves's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I THINK JUST TAKE IT, IF U FAIL U KNOW UR LIMIT
  2. input <form action=" " method="post" enctype="multipart/form-data"> <div class="modal-body"> <div class="form-group"> <label class="form-control-label">Contractor's Company Name :</label> <input type="text" name="companyname" class="form-control"/><br><br> <input type="hidden" name="email" value="<?php echo $_SESSION['email']?>"> <label class="form-control-label">Responsible Person's Name :</label> <input type="text" name="responsiblename" class="form-control"> </div> <div class="form-group"> <label>Fit Out Description :</label> <textarea name="editor1" class="form-control"></textarea> </div> <div class="form-group"> <label>Photos :</label> <input type="file" name="photos"/> <p style="color: red">Ekstensi yang diperbolehkan .png | .jpg | .jpeg | .gif</p> </div> </div> <div class="modal-footer"> By clicking apply you are agree to all terms and condition mentioned above &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <button class="btn btn-danger" style="border-radius:0%;" data-dismiss="modal">Close</button> <input type="submit" class="btn btn-success" style="border-radius:0%;" name="apply" value="Apply"> </div> </form> process <?php if (isset($_POST['apply'])){ $email=$_SESSION['email']; $companyname = $_POST['companyname']; $responsiblename = $_POST['responsiblename']; $description = $_POST['editor1']; $photos = file_get_contents($_FILES['photos']['tmp_name']); $sql = "INSERT INTO leaves(email,companyname,responsiblename,description,photos)VALUES('$email','$companyname','$responsiblename','$description','$photos') "; $run = mysqli_query($con,$sql); if($run == true) { echo "<script> alert('Entering Items Requested, Please Wait For 'Approved' Status'); window.open('dashboard.php','_self'); </script>"; } else { echo "<script> alert('Failed To Apply'); </script>"; } } ?> output <tbody> <?php $sql = "SELECT * FROM leaves WHERE email='".$_SESSION['email']."'"; $que = mysqli_query($con,$sql); $cnt=1; while ($result = mysqli_fetch_assoc($que)) { ?> <tr> <td><?php echo $cnt;?></td> <td><?php echo $result['email'];?> </td> <td><?php echo $result['companyname']; ?></td> <td><?php echo $result['responsiblename']; ?></td> <td><?php echo $result['description']; ?></td> <td><?php echo '<img src="data:image/jpg;base64,'.base64_encode($result['photos']).'" />';?></td> <td> <?php if ($result['status'] == 0) { echo "<span[$cnt] class='badge badge-warning'>Pending</span>"; } else{ echo "<span class='badge badge-success'>Approved</span>"; } $cnt++; } ?> </td> </tr> </tbody> what I want: the blob file type shown as image in web page and downloadble after click.Table contains: email,company name, responsible name,description, photos, and status.Column photos are setted within longblob type. the insert already sucessfull, but the output in web page shown crashed image block. maybe something wrong within base64_encode?
×
×
  • 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.