User Tools

Site Tools


en:web_development:forms:get

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:web_development:forms:get [2022/01/13 15:37]
mag created
en:web_development:forms:get [2023/08/16 09:33] (current)
Line 26: Line 26:
   * In both cases, the link will take the user to our other page 'process_form.php' which we will use to process the data.   * In both cases, the link will take the user to our other page 'process_form.php' which we will use to process the data.
   * Each link includes a <html>?</html> following the filename, then the name of the hero chosen.   * Each link includes a <html>?</html> following the filename, then the name of the hero chosen.
 +  * We've intentionally only used hero names that are only one word long because spaces are slightly more complex.
   * Save and upload the code, then open the page and click one of the heroes.   * Save and upload the code, then open the page and click one of the heroes.
   * You should see the data corresponding to the hero you chose.   * You should see the data corresponding to the hero you chose.
Line 32: Line 33:
 ==== GET ==== ==== GET ====
   * In PHP, we can obtain this data by 'getting' it from the URL.   * In PHP, we can obtain this data by 'getting' it from the URL.
-  * All data in the url is automatically stored in a global variable called '$_GET'+  * All data in the url is automatically stored in an array called '$_GET'
-  * A global variable is +  * Open 'process_form.php'
 +  * Add the following code inside your <html><main></html> tag. 
 +<code>        <p>You have chosen <?php echo $_GET['name']; ?></p></code> 
 +  * This displays text and includes the name you chose in 'form.php'
 +  * Save and upload the code, then open 'form.php' and click on a hero. 
 +  * Check that your choice is reflected in the text on the new page. 
 + 
 +[[en:web_development:forms:inputs|Next: Inputs]]
en/web_development/forms/get.1642117058.txt.gz ยท Last modified: 2023/08/16 09:33 (external edit)