I have a form in a module on a web page where the user can enter his name and e-mail when he wants to join an event.
This data is then stored in a submission table.
I use a databasejoin with a radio button to select an event from the events table.
The event table contains an event name, date and price. There can be several different events and one event can have several dates.
This table is updated remotely from a different server. (I use an form with the upsert plugin for that)
Every event has its own form (and web pages), so only a date needs to be selected.
In the databasejoin where box I added the event name as a string. The radio button simply shows some dates the user can select from.
After the user has saved the form an e-mail is send, informing him that he has just selected this date and some more info. So far, so good.
But what I am looking for is to add more data to the e-mail: the price and the event name from the event table.
Now I need to put the price and event name hard coded in the e-mail, but I want it automatically inserted from the event table.
Since I have the selected ID I could use a query to look it up; tried that, but I can not get that to work.
Using a php variable for the ID in the where query does not work a fixed number does work however.
It then also takes quite some time to send the e-mail.
I use some php in the advanced box of the radio button to format the date, that works great (like in the example $opt->text = $date->format('l j F Y').
So I tried to use php in the advanced box to assign a value to a variable that I can use later in the e-mail, but I could not figure that out. I changed the where clause to concat a second value, so I have date and price. Then in the advanced box I split date and price to seperate variables, format date as before and changed $opt->text to show date only. This works and now I have a new vaiable that contains the price, but how to insert this new variable in the e-mail?
Second what I would like to have is that I can have the event name in the module or link.
If I need to add another event, I need to create another form (make a copy) and change the where clause in the databasejoin element for that form and also create another e-mail. Of course I need to make another module, but I would like to have an option in the module to enter the event name. This event name would than be used in the databasejoin where clause and in the e-mail. In that way I can easely use the same form for another event.
Maybe I should follow a quite different strategy on this, but for now I could not think of any other approach.
Some idea's how to fix this are appreciated.
Henk
This data is then stored in a submission table.
I use a databasejoin with a radio button to select an event from the events table.
The event table contains an event name, date and price. There can be several different events and one event can have several dates.
This table is updated remotely from a different server. (I use an form with the upsert plugin for that)
Every event has its own form (and web pages), so only a date needs to be selected.
In the databasejoin where box I added the event name as a string. The radio button simply shows some dates the user can select from.
After the user has saved the form an e-mail is send, informing him that he has just selected this date and some more info. So far, so good.
But what I am looking for is to add more data to the e-mail: the price and the event name from the event table.
Now I need to put the price and event name hard coded in the e-mail, but I want it automatically inserted from the event table.
Since I have the selected ID I could use a query to look it up; tried that, but I can not get that to work.
Using a php variable for the ID in the where query does not work a fixed number does work however.
It then also takes quite some time to send the e-mail.
I use some php in the advanced box of the radio button to format the date, that works great (like in the example $opt->text = $date->format('l j F Y').
So I tried to use php in the advanced box to assign a value to a variable that I can use later in the e-mail, but I could not figure that out. I changed the where clause to concat a second value, so I have date and price. Then in the advanced box I split date and price to seperate variables, format date as before and changed $opt->text to show date only. This works and now I have a new vaiable that contains the price, but how to insert this new variable in the e-mail?
Second what I would like to have is that I can have the event name in the module or link.
If I need to add another event, I need to create another form (make a copy) and change the where clause in the databasejoin element for that form and also create another e-mail. Of course I need to make another module, but I would like to have an option in the module to enter the event name. This event name would than be used in the databasejoin where clause and in the e-mail. In that way I can easely use the same form for another event.
Maybe I should follow a quite different strategy on this, but for now I could not think of any other approach.
Some idea's how to fix this are appreciated.
Henk