Hi Skye,

If you had a tiddler called "CourseData", like this:

UBWA,Underwater Basket Weaving,2010-01-04,2010-01-25,2010-02-01
UBWB,Underwater Basket Weaving Advanced,
2010-01-04,2010-01-25,2010-02-01,2010-02-22

(Note, each class should be on one line, though google groups may
wrap)
then the following script would automate the option lists:

<script>
var out="" ;
out += "<html>" ;
out += "<form href='test.php'>\n" ;
var courseTiddler = "CourseData" ;
var formId = "SKYE" ;
var araCourses = store.getTiddlerText(courseTiddler).split("\n") ;
for(var i=0;i<araCourses.length;i++) {
  if(! araCourses[i]) continue ;
  var data = araCourses[i].split(",") ;
  var courseId = formId + "_" + data[0] ;
  var courseName = data[1]
  out += "<b>Course dates for:</b> " + courseName + "<br>" ;
  out += "<select name='" + courseId + "'>\n" ;
  out += "<option>-- Not taking --</option>\n" ;
  for(var j=2;j<data.length;j++) {
    out += "<option>" + data[j]+"</option>\n" ;
  }
  out += "</select>\n" ;
}
out += "<input type='submit'>\n" ;
out += "</form>\n" ;
out += "</html>\n" ;
return out ;
</script>

Once again, make sure that Google Groups doesn't wrap stuff. This is
obviously just a starter -- I left out the name fields since you
already have code for that and probably won't like my formatting
anyway ;-)

For the PHP, its mostly the principle that's important: Send fields
using a systematic naming convention, and then you can break out what
needs to be sent as email.

Its likely that most PHP books will have a sample script showing how
to email AND save results to a text file. However, I would not
recommend that that file be incorporated into a working TW. In fact,
if possible, it should be saved in a password-protected directory
(htaccess can do that). Nowadays you have to be constantly mindful of
hackers when doing even simple CGI.

Likewise, your working TW should be, if possible, in a password
protected directory so that only your students will readily find it.
Once you have a form on line that generates email, you will find that
hackers frequently probe your security, looking for some weakness to
see if they can get the form to forward sp-am for them. With a well-
made form, all they should be able to accomplish is sending *you* (not
the world) random, pointless spams. However, even this is annoying.
Some canned scripts that may still be floating around actually took an
email address as an argument, allowing hackers to turn the server into
a spam forwarder.

Mark


On Dec 20, 6:16 am, skye riquelme <riquelme.s...@gmail.com> wrote:
> Hi Mark
>
> could you send to me the examples you mentioned....using
> InlineJavaScript to generate a form and and an example of the

--

You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlyw...@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.


Reply via email to