Passing data from a form and retrieving it using WebDNA
numero = 155<html><form method="post" action="formprocess.dna"><input type="text" name="data" size="30"></br><input type="submit"></form></html>This cannot be simpler :-) Let's see the formprocess.dna now:Make sure your page starts with <!--HAS_WEBDNA_TAGS--> and then, we will recover the data. What was the name of the field passing the data? "data"So, to recover your data, just do this:
<!--HAS_WEBDNA_TAGS-->[data]Write anything you want in the form, submit, and you will see the second page, formprocess.dna, with what you wrote. Pretty simple, huh?Now, let's imagine you want to do something with the data; for instance, show a personal message to Chris and just say hello to anybody else:
<!--HAS_WEBDNA_TAGS-->[showif [data]=chris]Hi Chris? did you buy the milk?[/showif][hideif [data]=chris]Hello there![/hideif]Let's do some math: write 4 plus 23 in the form, and
<!--HAS_WEBDNA_TAGS-->[math][data][/math]in formprocess.dna, it will return "27"And what if your data is an email address that would send a specific email to the registered user? The subject will be "Thank you" and the message "Thank you for registering! Today is thedate"Make your formprocess.dna like this:
<!--HAS_WEBDNA_TAGS-->[SendMail to=[data]&from=me@mydomain.com&subject=Thank you]Thank you for registering! today is [date][/SendMail]>>> Next page... Now let's interact with WebDNA: send it some data, some instructions, and see WebDNA process it.
<html>
<form method="post" action="formprocess.dna">
<input type="text" name="data" size="30">
</br>
<input type="submit">
</form>
</html>
<!--HAS_WEBDNA_TAGS-->
[data]
<!--HAS_WEBDNA_TAGS-->
[showif [data]=chris]Hi Chris? did you buy the milk?[/showif]
[hideif [data]=chris]Hello there![/hideif]
<!--HAS_WEBDNA_TAGS-->
[math][data][/math]
<!--HAS_WEBDNA_TAGS-->
[SendMail to=[data]&from=me@mydomain.com&subject=Thank you]
Thank you for registering! today is [date]
[/SendMail]
DOWNLOAD WEBDNA NOW!
A short introduction to WebDNA programming for absolute beginner...
3. Passing Data from a FormPassing data from a form and retrieving it using WebDNA...
4. Password ProtectingHow to password-protect a page using WebDNA...
2. Conditional ProgrammingConditional programming with WebDNA...
1. Learn WebDNA ProgrammingLearning WebDNA programming: the very basics...
6. Working with DatabasesWorking with WebDNA database...