trouble populating form with mysql data
Hi
I am trying to create a edit and update php page but not got to the update page yet as having issues populating the form with the mysql data ready for updating, I keep getting undefined variable errors within the input fields, I am really stuck with it
I thought by adding the following would solve it but didn't
PHP Code:
$customer_name = $_POST['customer_name'];
The whole code I have is below
PHP Code:
<?php
$servername = "";
$username = "";
$password = "";
$dbname = "";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
<form action="update-admin-repair-tracking.php" method="post">
<label>Customer Name</label>
<input type="text" name="customer_name" value="<?php echo $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>
Been trying to suss it for ages, sorry
Thank you in advance
Ian