divinedesigns1 Posted April 24, 2012 Share Posted April 24, 2012 im working on this excerise but the only problem im having is the last part of testing to see if the script works, everything works perfectly well i fixed the typos but when it came to the deleting part the submit button there doesnt work at all this is the script i have atm <?phprequire_once('my_connect.php');require_once('skimg.php');if(isset($_GET['id']) && isset($_GET['date']) && isset($_GET['name']) && isset($_GET['score']) && isset($_GET['screenshot'])) {//Grab the score datat from the GET$id = $_GET['id'];$date = $_GET['date'];$name = $_GET['name'];$score = $_GET['score'];$screenshot = $_GET['screenshot'];}else if(isset($_POST['id']) && isset($_POST['name']) && isset($_POST['score'])){//Grab data from the POST$id = $_POST['id'];$name = $_POST['name'];$score = $_POST['score'];}else {echo '<p class="error">Sorry, no high score was specified for removal. </p>';}if(isset($_POST['submit'])){if($_POST['confirm'] == 'Yes'){ //Delete the screenshot image file from the server @unlink(SK_UPLOADPATH . $screenshot); //connect to the database $conn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); //Delete the score data from the database $query = "DELETE FROM scorekeeper WHERE id=$id LIMIT1"; mysqli_query($conn, $query); mysqli_close($conn); //Confirm success with the use echo '<p>The high score of ' . $score . ' for ' . $name . ' was successfully removed.';}else{ echo '<p class="error"> The high score was not removed.</p>';}}else if(isset($id) && isset($name) && isset($date) && isset($score)){echo '<p>Are you sure you want to delete the following high score?</p>';echo '<p><strong>Score: </strong>' . $name . '<br/><strong>Date: </strong>' . $date . '<br/><strong>Score: </strong>' . $score . '</p>';echo '<from method="post" action="remove.php">';echo '<input type="radio" name="confirm" value="Yes" /> Yes ';echo '<input type="radio" name="confirm" value="NO" checked="checked" /> NO <br/>';echo '<input type="submit" value="submit" name="submit" />';echo '<input type="hidden" name="id" value="' . $id . '" />';echo '<input type="hidden" name="name" value="' . $name . '" />';echo '<input type="hidden" name="score" value="' . $score . '" />';echo '</form>';}echo '<p><a href="admin.php"><<Back to admin page</a></p>';?> i was checking this code for a while now and i dont see anything wrong with it, i even compare it to the book, went over it step by step line by line and nothing, so im thinking the submit button action is set to none, im not too sure how to change it to submit in php, so if you guys dont see any problem can you tell me how to change the button action from none to submit in php? thank you once again Link to comment Share on other sites More sharing options...
Ingolme Posted April 24, 2012 Share Posted April 24, 2012 I can't see anything wrong with the code. What happens when you click the submit button? Link to comment Share on other sites More sharing options...
dsonesuk Posted April 24, 2012 Share Posted April 24, 2012 echo '<from method="post" action="remove.php">';FROM what i can see and the FROM my perspective there seems to something wrong with the FORM element? hmmmmm Link to comment Share on other sites More sharing options...
divinedesigns1 Posted April 24, 2012 Author Share Posted April 24, 2012 echo '<from method="post" action="remove.php">'; FROM what i can see and the FROM my perspective there seems to something wrong with the FORM element? hmmmmm smh @ myself and i been here for the longest while trying to fix the error even print it out to make sure im reading it correct hehehehehehe #imweak Thank you dsoneI can't see anything wrong with the code. What happens when you click the submit button?nothing wasnt happening but dsone found the error hehehehehe Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.