Here are my two pages I am using to edit. One is the HTML form and the next is the code to insert the changes. I have looked overthis code for a few hours and have not seen anything wrong.

I hope it is not something super simple or I will feel dumb :'(

<?php
include_once 'resources/init.php';
if (isset ($_GET[id])) {
    $q = "SELECT * FROM workorder WHERE id={$_GET[id]}";
    $result = mysql_query($q);
    $client = mysql_fetch_array($result);
    }
?>
    <a href="index.php">Back To List</a>

<form action="edit.php" method="post">
Finished?: <select name="finished" value="finished">
<option value="<?php echo $client['finished']; ?>" /><?php echo $client['finished']; ?></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
Current Status: <select name="cstat" value="cstat">
<option value="<?php echo $client['cstat']; ?>" /><?php echo $client['cstat']; ?></option>
<option value="Not Started">Not Started</option>
<option value="Diagnosing">Diagnosing</option>
<option value="Fixing">Fixing</option>
<option value="Finished">Finished</option>
<option value="Waiting For Pickup">Waiting For Pickup</option>
<option value="Not Fixing">Not Fixing</option>
<option value="Unknown">Unknown</option>
</select>
<br>
<br>
Invoice #: <input type="text" name="invoice" maxlength="5" size="5" value="<?php echo $client['invoice']; ?>" />
<br>
<br>
Date Received: <input type="text" name="dater" maxlength="50" size="10" value="<?php echo $client['dater']; ?>" />
Priority: <select name="priority" value="priority">
<option value="<?php echo $client['priority']; ?>" /><?php echo $client['priority']; ?></option>
<option value="Low">Low</option>
<option value="Med">Med</option>
<option value="High">High</option>
</select>
<br>
<br>
First Name: <input type="text" name="firstn" maxlength="50" size="15" value="<?php echo $client['firstn']; ?>" />
Last Name: <input type="text" name="lastn" maxlength="50" size="15" value="<?php echo $client['lastn']; ?>" />
<br>
<br>
Company:<input type="text" name="comp" maxlength="50" size="15" value="<?php echo $client['comp']; ?>" />
Contact<input type="text" name="contac" maxlength="50" size="15" value="<?php echo $client['contac']; ?>" />
<br>
<br>
<i>Address</i>
<br>
<textarea rows="3" cols="20" name="addres" wrap="physical"><?php echo $client['addres']; ?></textarea><br />
<br>
Phone: <input type="text" name="phone" maxlength="12" size="12" value="<?php echo $client['phone']; ?>" />
Cell: <input type="text" name="cell" maxlength="12" size="12" value="<?php echo $client['cell']; ?>" />
<br>
<br>
<br>
Email: <input type="text" name="email" maxlength="50" size="30" value="<?php echo $client['email']; ?>" />
Email Client: <input type="text" name="emailc" maxlength="50" size="15" value="<?php echo $client['emailc']; ?>" />
<br>
<br>
<br>
ISP: <input type="text" name="isp" maxlength="50" size="20" value="<?php echo $client['isp']; ?>" />
Router: <select name="router" value="router">
<option value="<?php echo $client['router']; ?>" /><?php echo $client['router']; ?></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
<option value="Unknown">Unknown</option>
</select>
<br>
<br>
Internet Username: <input type="text" name="internetu" maxlength="50" size="10" value="<?php echo $client['internetu']; ?>" />
Internet Password: <input type="text" name="internetp" maxlength="50" size="10" value="<?php echo $client['internetp']; ?>" />
<br>
<br>
Computer Type: <input type="text" name="comptyp" maxlength="50" size="30" value="<?php echo $client['comptyp']; ?>" />
Laptop Cord: <select name="lapcord" value="lapcord">
<option value="<?php echo $client['lapcord']; ?>" /><?php echo $client['lapcord']; ?></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
<option value="Broken">Broken</option>
</select>
<br>
<br>
OS Type:<input type="text" name="ostyp" maxlength="50" size="24" value="<?php echo $client['ostyp']; ?>" />
<br>
<br>
Windows Key:<input type="text" name="winkey" maxlength="23" size="23" value="<?php echo $client['winkey']; ?>" />
<br>
<br>
PC Description:<input type="text" name="compdis" maxlength="50" size="30" value="<?php echo $client['compdis']; ?>" />
<br>
<br>
Current Anti-Virus:<input type="text" name="currav" maxlength="50" size="10" value="<?php echo $client['currav']; ?>" />
Install Anti-Virus:<input type="text" name="instav" maxlength="50" size="10" value="<?php echo $client['instav']; ?>" />
<br>
<br>
Browser: <input type="text" name="browse" maxlength="50" size="10" value="<?php echo $client['browse']; ?>" />
<br>
<br>
<i>Critcal Data</i>
<br>
<textarea rows="7" cols="60" name="critdata" wrap="physical"><?php echo $client['critdata']; ?></textarea><br />
<br>
<br>
<i>Computer Issue</i>
<br>
<textarea rows="7" cols="60" name="compiss" wrap="physical"><?php echo $client['compiss']; ?></textarea><br />
<br>
<i>CheckList</i>
<br>
<textarea rows="24" cols="60" name="checkl" wrap="physical"><?php echo $client['checkl']; ?></textarea><br />
<br>
<i>Hardware</i>
<br>
<textarea rows="7" cols="60" name="hware" wrap="physical"><?php echo $client['hware']; ?></textarea><br />
<br>
<i>Notes</i>
<br>
<textarea rows="7" cols="60" name="notes" wrap="physical"><?php echo $client['notes']; ?></textarea><br />
<br>
<br>
<input type="submit" name="submit" Value="Modify" />
</form>

** This is the Start of my next page**

    <?php
    include_once 'resources/init.php';

        $sql="UPDATE workorder SET `finished`='{$_POST['finished']}',
                `cstat`='{$_POST['cstat']}',
                `invoice`='{$_POST['invoice']}',
                `dater`='{$_POST['dater']}',
                `priority`='{$_POST['priority']}',
                `firstn`='{$_POST['firstn']}',
                `lastn`='{$_POST['lastn']}',
                `comp`='{$_POST['comp']}',
                `contac`='{$_POST['contac']}',
                `addres`='{$_POST['addres']}',
                `phone`='{$_POST['phone']}',
                `cell`='{$_POST['cell']}',
                `email`='{$_POST['email']}',
                `emailc`='{$_POST['emailc']}',
                `isp`='{$_POST['isp']}',
                `router`='{$_POST['router']}',
                `internetu`='{$_POST['internetu']}',
                `internetp`='{$_POST['internetp']}',
                `comptyp`='{$_POST['comptyp']}',
                `lapcord`='{$_POST['lapcord']}',
                `ostyp`='{$_POST['ostyp']}',
                `winkey`='{$_POST['winkey']}',
                `compdis`='{$_POST['compdis']}',
                `currav`='{$_POST['currav']}',
                `instav`='{$_POST['instav']}',
                `browse`='{$_POST['browse']}',
                `critdata`='{$_POST['critdata']}',
                `compiss`='{$_POST['compiss']}',
                `checkl`='{$_POST['checkl']}',
                `hware`='{$_POST['hware']}',
                `notes`='{$_POST['notes']}'

                WHERE id='{$_POST['id']}'";

if (!mysql_query($sql))

die('Error: ' . mysql_error());
{
echo "<h5>Work Order Has Been Edited Sucsessfully.</h5>";
}
mysql_close($con)
?>

<a href="index.php">Back To List</a>

WHERE id='{$_POST['id']}'";

You should put the id in a hidden input in your form, it is missing.

Slaps Head! DUH! Thanks man.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.