Capturing Your Form Data
Last updated
Last updated
Previously, in , we made a form that submitted two value but had no way of seeing where the data went or had any way to access that data to do anything with it. A server side language allows you to capture, manipulate and use that data easily.
Previously, we were focused on making sure our form was visually appearing the way we wanted. Now we need to ensure that our form has all the properties present that we need to make the data usable.
Open the manageArticles.bxm page in VSCode.
Wrap your entire form in <bx:output> </bx:output>. That will make sure that BoxLang will fill in any BoxLang variables needed.
In your form tag, make sure you have these attributes
action="#cgi.script_name#" - This is one of the BoxLang variables. This will tell the page to submit the form data to this same page.
method="POST" - This will tell form how the data is to be submitted.
Your final form tag should look like this:
In addition to the type and other properties your input tags have, each of them should have a name
property. <input type="text" name="title" ...... />
At the very top of your page put the line of code
Enter some data into your form and submit it. You should see you information appear at the top of the page like this:
If you don't, make sure you followed all the directions on this page including wrapping the form in <bx:output> </bx:output>, putting a name property on all of your <input /> tags and putting the <bx:dump> at the top of the page.