• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14. Using PHP with JavaScript > Passing Data from JavaScript to PHP

Passing Data from JavaScript to PHP

In the role of a confirmation tool, JavaScript can check the content of forms before data is sent to a PHP script. Such a role is important for real-world forms because, if troublesome data are sent to a PHP script, the wrong data could end up in your database.

PHP recognizes data from an HTML form element using the same naming structure, but with the added dollar sign before the variable name. For example, if a form element is named this:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint