[FX.php List] How to form a URL in FM to embed data into add page

Erik Andreas Cayré erik at cayre.dk
Sat May 12 05:13:08 MDT 2007


Den 11/05/2007 kl. 23.25 skrev Larry Schultz:

> newbie here.
>
> I'd like to use the send email script in FM and have a link (URL)  
> in the body like:
> http://myserver/mysite/addpage.php  and embed a few related record  
> ID's in the URL.
>
> I have no idea how to do this. ANY help would be greatly appreciated.
>
> What I'm trying to accomplish: Send an email from a contact record  
> to a related person they used for a reference (for the purpose of  
> evaluation) they provide and include The contact's Filemaker Record  
> ID AND the Reference ID. I'd like to be able to pull a little  
> contact and reference detail at the top of the page to give the  
> user some idea of who they are evaluating.
>
> It's been a long week... I hope I'm making sense

Have your Send Email script step in FM use a calculated field for the  
body of your message.
The calculation can then contain whatever text you need, including  
data from fields in the current and related tables.

The URL would be something like http://server/addpage.php?a=12&b=45

The question mark is how you specify GET parameters in a http request.
a and b are just examples of variable names (generic: not exposing  
details in your solution).

In addpage.php you could reference them like this:

$contactid = $_GET['a']
$referenceid = $_GET['b']

You can then use these to reference records in your DB for lookup/ 
submit/update or whatever you need.

You should probably consider validating the user input, since any  
user could experiment with other values of a and b. You wouldn't want  
data corruption (or worse: loss)  as a result of 'creative' users...!
One way to do this is to have the user submit their email address in  
a form. You can then check that this email address matches the one  
you sent the URL to.

PS: You can't use POST in this scenario, so there is no way to hide  
the values of variables. One way around this would be to generate  
random unique IDs for the URL to go in the email message. You would  
need to keep these IDs in a separate table in FM with appropriate  
relations to real tables, only used to locate the correct  
information, when a user clicks the URL in the email body. This  
strategy would make it much more unlikely for a 'creative' user to do  
any harm to your solution...

I also hope I'm making sense...!

---
Erik Andreas Cayré
Spangsbjerg Møllevej 169
DK-6705 Esbjerg Ø

Home Tel: +45 75150512
Mobile: +45 40161183

»Interest can produce learning on a scale compared to fear as a  
nuclear explosion to a firecracker.«
--Stanley Kubrick

»If you can't explain it simply, you don't understand it well enough.«
-- Albert Einstein

»If you don't have time to do it right, when will you have time to do  
it over?«
-- John Wooden, basketball coach




More information about the FX.php_List mailing list