waterwn1097 Posted January 5, 2014 Share Posted January 5, 2014 okay so here is the deal, I have an entire website completely set up with a registration page and the whole nine. Once a client has been registered i would like to be able to login to my admin page on my website and update some of the values contained in that clients row so then they have their own page that has been uniquely updated. <?php include_once("scripts/connect.php"); $message = ''; if ($_POST['state']) { $id = $_POST['id']; $contractlink = $_POST['contractlink']; $foliolink = $_POST['foliolink']; $status = $_POST['status']; $quote = $_POST['quote']; $deposit = $_POST['deposit']; $sql = mysql_query("UPDATE clients SET contractlink='$contractlink', foliolink='$foliolink', status='$status', quote='$quote', deposit='$deposit' WHERE id='$id'"); $message = "The Customers Information has been updated."; } ?> and here is the form code <table width="600" align="center" cellpadding="5"> <form action="adminin.php" method="post"> <p><font color="red"><?php print("$message");?></font></p> <tr> <td width="163"><div align="right">ID:</div></td> <td width="409"><input type="text" name="id" placeholder="ID" /></td> </tr> <tr> <td><div align="right">Contract Link:</div></td> <td><input type="text" name="contractlink" placeholder="Contract Link" /></td> </tr> <tr> <td><div align="right">Folio Link:</div></td> <td><input type="text" name="foliolink" placeholder="Folio Link" /></td> </tr> <tr> <td><div align="right">Quote:</div></td> <td><input type="text" name="quote" placeholder="Quote" /></td> </tr> <tr> <td><div align="right">Deposit:</div></td> <td><input type="text" name="deposit" placeholder="Deposit" /></td> <tr> <td><div align="right">Status:</div></td> <td><select name="status"> <option value="Waiting On DJ">Waiting on DJ</option> <option value="Waiting On Customer">Waiting on Customer</option> </select></td> </tr> <tr> <td><div align="right"></div></td> <td><input type="submit" name="Submit" value="submit" /></td> </tr> </form> </table> the problem I am having is that the data is not updating. What am I doing wrong? thank you all! Quote Link to comment https://forums.phpfreaks.com/topic/285102-help-updating-a-mysql-database-with-a-form/ Share on other sites More sharing options...
Ch0cu3r Posted January 5, 2014 Share Posted January 5, 2014 You do not have a field called state in your form. if ($_POST['state']) { Maybe change it to if(isset($_POST['Submit'])) { Quote Link to comment https://forums.phpfreaks.com/topic/285102-help-updating-a-mysql-database-with-a-form/#findComment-1463909 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.