Handling Image Input 

Handling Image Input
  • As you saw earlier, it is very easy to use the NAME value of an HTML SUBMIT button to determine which action to perform in a script. Thus, we typically see code as follows: 
  • if (delete button ne "")
      {
      do something
      }
  • In other words, if the user has clicked the delete button (and the delete button has been assigned the VALUE), we will perform a deletion. If however, some other button is pressed, the VALUE of the delete button will be null and the action will not be performed. 
  • However, what if the user clicked an INPUT TYPE = "image" button? 
  • In this case, we will use similar logic... 
  • if ($form_data{'delete_image.y'} > 0)
      {
      do something
      }
  • As you can see, the script checks to see if the y coordinate has been assigned a value (meaning the user clicked on it) and if so, performs an action. 

Additional Resources:

Non-Parsed Header Scripts
Table of Contents
Debugging CGI Scripts


Graphics & Media Lab. >> Библиотека | Курсы | Графикон

Hosted by Graphics & Media Lab
http://graphics.cs.msu.su
lab_logo
mailto: Laboratory