Hi I am trying to make a edit page but having an issue with populating the form with the mysql data
I have the following code but am getting Notice: Undefined variable: id in /home/sites/it-doneright.co.uk/public_html/admin/repairs-tracking/edit-repair-tracking.php on line 52
[CODE]
<?php
$servername = “localhost”;
$username = “”;
$password = “”;
$dbname = “”;
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}
$sql = “SELECT * FROM repairs WHERE id=’$id'”;
//$result = mysqli_query($sql);
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_array($result);
?>
<form action=”update-admin-repair-tracking.php” method=”post”>
<label>Repair ID</label>
<input name=”id” value=”<?php echo $row[‘id’]; ?>”>
<label>Customer Name</label>
<input type=”text” name=”customer_name” value=”<?php echo $row[‘$customer_name’]; ?>”>
<label>Customer Email</label>
<input type=”text” name=”customer_email” value=”<?php echo $row[‘customer_email’]; ?>”>
<label>Customer Phone</label>
<input type=”text” name=”customer_phone” value=”<?php echo $row[‘customer_phone’]; ?>”>
<label>Computer Make</label>
<input type=”text” name=”computer_make” value=”<?php echo $row[‘computer_make’]; ?>”>
<label>Computer Model</label>
<input type=”text” name=”computer_model” value=”<?php echo $row[‘computer_model’]; ?>”>
<label for=”technician”>Technician:</label>
<select name=”technician” id=”technician”>
<option value=”Not Assigned”>Not Assigned</option>
<option value=”Phil Roskams”>Phil Roskams</option>
<option value=”Ian Haney”>Ian Haney</option>
</select>
<label for=”status”>Status:</label>
<select name=”status” id=”status”>
<option value=”Not Started”>Not Started</option>
<option value=”In Queue”>In Queue</option>
<option value=”On Bench / Working”>On Bench / Working</option>
<option value=”Awaiting Parts”>Awaiting Parts</option>
<option value=”Awaiting Customer”>Awaiting Customer</option>
<option value=”Completed”>Completed</option>
</select>
<label>Expected Repair Date</label>
<input type=”date” name=”exrdate” value=”<?php echo $row[‘exrdate’]; ?>”>
<label>Expected Repair Time</label>
<input type=”time” name=”exrtime” value=”<?php echo $row[‘exrtime’]; ?>”>
<label>Expected Start Date</label>
<input type=”date” name=”exstdate” value=”<?php echo $row[‘exstdate’]; ?>”>
<label>Expected Start Time</label>
<input type=”time” name=”exstime” value=”<?php echo $row[‘exstime’]; ?>”>
<label for=”deltype”>Delivery Type:</label>
<select name=”deltype” id=”deltype”>
<option value=”Self Pickup”>Self Pickup</option>
<option value=”Deliver to Customer”>Delivery to Customer</option>
</select>
<label for=”comments”>Comments:</label>
<br>
<textarea name=”comments” cols=”50″ rows=”3″ id=”comments”><?php echo $row[‘comments’]; ?></textarea>
<input type=”submit” VALUE=”Update Repair Tracking” NAME=”Submit”>
</form>
Thank you in advance
Ian