kobena Posted March 30, 2011 Share Posted March 30, 2011 php version 5.3.1 mysql 5.1.41 xampp 1.7.3 Hi all, I am trying to update a record using the edit_user principle but to no success. My check indicates that my hidden parameter(dailydelivery_id) is not passed. can you please check if there is something wrong with the following code summary? <form method="post" action="edit_dailydelivery.php"> . . . <p><input type="submit" name="submit" value="UPDATE" /></p> <input type="hidden" name="submitted" value="TRUE"/> <input type="hidden" name="dailydelivery_id" value="' . $id . '" /> I then try to get hidden parameter using: // Check for a valid dailydelivery ID, through GET or POST: if ( (isset($_GET['dailydelivery_id'])) && (is_numeric($_GET['dailydelivery_id'])) ) { // From view_dailydeliveries.php $id = $_GET['dailydelivery_id']; } elseif ( (isset($_POST['dailydelivery_id'])) && (is_numeric($_POST['dailydelivery_id'])) ) { // Form submission. $id = $_POST['dailydelivery_id']; } else { // No valid ID, kill the script. echo '<p class="error">This page has been accessed in error.</p>'; include ('includes/footer.html'); exit(); } and i get the error "This page has been accessed in error." It worth mentioning that the get works perfectly. Link to comment Share on other sites More sharing options...
Larry Posted March 30, 2011 Share Posted March 30, 2011 The code you posted doesn't show PHP echo'ing or printing the value of $id. What does the HTML source code of the page look like (specifically for that input)? Link to comment Share on other sites More sharing options...
Stuart Posted March 30, 2011 Share Posted March 30, 2011 Like Larry said you're not actually echoing out the value of $id. Everywhere else on your form when you've broke back into PHP tags to print it e.g. value="<?php echo $main_row['variance'] ?>" But when you've tried to print the value of $id you've simply done: <input type="hidden" name="dailydelivery_id" value="' . $id . '"/> That line is outside any PHP tags and therefore being treated as HTML only. Change to: <input type="hidden" name="dailydelivery_id" value="<?php echo $id; ?>"/> 1 Link to comment Share on other sites More sharing options...
kobena Posted March 31, 2011 Author Share Posted March 31, 2011 Thanks stuart and larry. i must admit that i was a bit careless. It solved the problem for me. Link to comment Share on other sites More sharing options...
Recommended Posts