tomm098 Posted August 26, 2009 Share Posted August 26, 2009 Hey all. I have a form that updates three rows in my database. I only want to let people update a record if a certain field is empty. For example, the three rows are 'Time' and 'Scene' and 'User'. If a scene already exists, I only wanna let the original user edit it. If the User's do not match up, and someone tries to update it, I need the form to reject the update. But if no Scene exists, I want to let anyone add a scene description. Here is the code for the 3 rows. <p> <input name="Time" type="text" id="Time" value="<?php echo $row_MusicBody['Time']; ?>" /> </p> <p> <textarea name="Scene" id="Scene" cols="23" rows="3"><?php echo $row_MusicBody['Scene Description']; ?></textarea> <p> <input name="User" type="hidden" id="User" value="<?php echo $_SESSION['MM_Username']; ?>" readonly="readonly" /> </p> </p> Link to comment https://forums.phpfreaks.com/topic/171924-update-form-only-if-entries-are-null/ Share on other sites More sharing options...
ignace Posted August 26, 2009 Share Posted August 26, 2009 if (empty($row_MusicBody['Scene Description']) ^ $row_MusicBody[Author'] === $_SESSION['MM_Username']) Link to comment https://forums.phpfreaks.com/topic/171924-update-form-only-if-entries-are-null/#findComment-906597 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.