First record do not update

Hi there, my first record do not update but ok in the others. thanks!

Edit <?php include('button_modal.php

–button_modal.php

<div class="modal fade" id="update<?php echo $frow['file_id']; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <center><h4 class="modal-title" id="myModalLabel">Edit <strong><?php echo $tin;?></strong> ?</h4></center>
            </div>
            <div class="modal-body">
			<?php
				$edit=mysqli_query($conn,"select * from file where file_id='".$frow['file_id']."'")or die(mysqli_error());
				$erow=mysqli_fetch_array($edit);
			?>
			<div class="container-fluid">
			<form method="POST" action="edit.php?id=<?php echo $erow['file_id']; ?>">
			

				<div class="row">
					<div class="col-lg-2">
						<label style="position:relative; top:7px;">Description:</label>
					</div>
					<div class="col-lg-10">
						<input type="text" name="filename" class="form-control" value="<?php echo $erow['file_id']; ?>">
					</div>
				</div>

				<div class="row">
					<div class="col-lg-2">
						<label style="position:relative; top:7px;">Remarks:</label>
					</div>
					<div class="col-lg-10">
						<input type="text" name="tradename" class="form-control" value="<?php echo $erow['trade_name']; ?>">
					</div>
				</div>


                           </div>
                           </div>
            <div class="modal-footer">

                 <button  type="submit" class="btn btn-info" class="fa fa-save"></i> Update</button>
                 <button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times" style="float: right>"</i> Close</button>
            </div>
			</form>
        </div>
    </div>
</div>

Welcome, Aboard!

Well, people who are going to help you are going to have to see more than just the HTML. They are going to need to see the PHP as well.

For example:

$cms = new CMS($_POST['cms']);


/*
 * If there are no errors then update the image,
 * otherwise just update the information.
 */
if ($_FILES['image']['error'] === 0) {

    unlink("../" . $_SESSION['old_image']); // Remove old image path from db table:

    $errors = array();
    $exif_data = [];
    $file_name = $_FILES['image']['name']; // Temporary file for thumbnails directory:
    $file_size = $_FILES['image']['size'];
    $file_tmp = $_FILES['image']['tmp_name'];
    $file_type = $_FILES['image']['type'];
    $file_ext = strtolower(pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION));

also

<form method="POST" action="edit.php?id=<?php echo $erow['file_id']; ?>">

that should be written this way:

<form method="post" action="edit.php" enctype="multipart/form-data">

You are trying to update a file (I’m assuming an image) and the “post” method is being used not “get”.

HTH a little, John

Sponsor our Newsletter | Privacy Policy | Terms of Service