Presentation on theme: "CHAPTER 10 COMMON PROGRAMMING TECHNIQUES. SENDING VALUES TO A SCRIPT Hidden form input type: Depending on the method, $_POST['do'] or $_GET['do'] will."— Presentation transcript:
SENDING VALUES TO A SCRIPT Hidden form input type: Depending on the method, $_POST['do'] or $_GET['do'] will have a value "this" Recall that the GET method sends variables through the URL, so the form part can be skipped by appending the name=value pair to the URL: www.example.com/page.php?do=this
SENDING VALUES TO A SCRIPT Edit To append multiple values to a URL, use & between each name=value pair If a string is sent through a URL, it should be encoded for proper handling. Use the urlencode() function: $url= 'page.php?name='. urlencode('Sam Smith');
DELETING A USER 1.Retrieve user names and ID's 2.Display user names using a loop, but don't display user ID 3.Put a hyperlink next to each name 4.Send the current userID to the delete page in the URL : this will be a $_GET value
DELETING A USER - CON'T 5.Validate the userID 6.Retrieve user information 7.Display record being deleted 8.Verify deletion from user (via a form - this will have a $_POST variable set) 9.Delete the record from the database.