[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Modcaml] How to use ::table(name):: - ::end::
From: |
Richard W. M. Jones |
Subject: |
Re: [Modcaml] How to use ::table(name):: - ::end:: |
Date: |
Sat, 23 Jul 2005 17:48:32 +0100 |
User-agent: |
Mutt/1.3.28i |
On Sat, Jul 23, 2005 at 05:47:33PM +0200, Stephany Francois wrote:
> ><form method=\"post\" action=\"essai2.cmo\">
> >Titre: <input name=\"titre\" value=\"Entrez le titre ici\"> <br>
> >Auteur: <input name=\"auteur\" value=\"Entrez l'auteur ici\"> <br>
> ><input type=\"submit\" value=\"Ajouter\"
> ></form> </body> </html>"
> > let list_of_param = q#params in
>From the form above, q#params will contain the following:
[ "titre", "Essais";
"auteur", "Freud" ]
So your map, below, is wrong:
> > let ta = List.map (fun (titre, auteur) -> ["titre" ,
> >Template.VarString titre; "auteur" , Template.VarString auteur ] )
> >list_of_param in
I think what you wanted is something like:
let titre = q#param "titre" in
let auteur = q#param "auteur" in
let ta = [ "titre", Template.VarString titre;
"auteur", Template.VarString auteur ] in ...
or the following code which is exactly equivalent:
let titre = List.assoc "titre" list_of_param in
let auteur = List.assoc "auteur" list_of_param in
let ta = [ "titre", Template.VarString titre;
"auteur", Template.VarString auteur ] in ...
Of course this is only going to produce a single row - obvious really,
since you've only asked for a single title / author pair!
You might want to have a look at storing your title(s) and author(s)
in a database ...
Bonne chance!
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com