Lesson 07: Handling Form Data

If a script being executed has form data posted in it’s request headers, this data may be automatically assigned to variables using the [[POST]] shortcode.

 Hello [[PRINT:First_Name]], [[PRINT:Last_Name]]

To combine the form and the handler into the same script we may use the [[IF_SUBMITTED]]  with the [[ELSE]]  and [[END_IF]] shortcodes to add flow control for the conditionally executed code.

Create a node and paste this following code into it’s landing page editor. Goto the node’s address and test with browser. Note that the first input value is preloaded or prepopulated with the value of the query string variable anything.

When testing this script add /?anything=testing123 to the URL. You should then see testing123 already written (prepopulated) into the First_Name form input field.

 Form Submitted[[cr]]
 Hello [[PRINT:First_Name]], [[PRINT:Last_Name]][[cr]]
 Here is the form.[[cr]][[hr]]
  [[INPUT:Last_Name|Enter Your Last Name]]

Leave a Reply