if (strlen($_GET['id']) > 0) { $dal = new DBLayer(); $array = $dal->findone(array('_id' => new MongoId($_GET['id']))); echo "<script> $(document).ready(function(){ document.getElementById('name').value = '{$array['name']}'; document.getElementById('description').value = '{$array['description']}'; document.getElementById('image').value = '{$array['image']}'; document.getElementById('about').value = '{$array['author']}'; document.getElementById('author').value = '{$array['author']}'; document.getElementById('url').value = '{$array['url']}'; document.getElementById('ingredients').value = '{$array['ingredients']}'; document.getElementById('instructions').value = '{$array['instructions']}'; }); </script>"; } if (empty($_POST["name"]) && empty($_POST["description"]) && empty($_POST["image"]) && empty($_POST["name"])) { echo 'Please Enter Recipe Information.'; } else { $thing = new Recipe(); echo $thing->updateRecipeWork(); echo 'Recipe Saved Successfully.'; } ?> <input type="hidden" id="recordId" name="recordId" value="<?php echo $_GET['id'] ?>"/> </form> </body> </html>