Displaying All a Form's Data At OnceWe'll start this chapter with a quick onedisplaying all the data a form sends to your web application. When you're creating a web application and things aren't going right, you can use a PHP page like the one we'll develop here to see what's actually being sent to your code. As an example, we'll stock an HTML page with a number of controls, as you see in phpformdata.html, Example 6-1. You can see what this sample page looks like in Figure 6-1. Example 6-1. Submitting data in a form, phpformdata.html
Figure 6-1. Submitting form data.[View full size image] To read the data sent by the user, just use a foreach loop over $_REQUEST. If a particular data item is itself an array, we'll use a nested foreach to display its data, as you see in phpformdata.php, Example 6-2. Example 6-2. Displaying all the data in a form, phpformdata.html
You can see the results in Figure 6-2, where all form data is displayed. Figure 6-2. Reading data from forms.[View full size image] |
Thursday, October 22, 2009
Displaying All a Form's Data At Once
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment