Sam Laundon Posted October 27, 2002 Posted October 27, 2002 First of all I want to thank those that have helped me with questions in the past. This forum has helped me develop a database solution for my clients that would have cost me thousands of dollars if I had hired someone to do the work. The problem: I have clients that sign in to the database through the web to view their records and place new orders. When they place a new order they also submit a photo through an upload photo page. This upload photo page is not through filemaker because to my knowledge there is no way to upload files through filemaker. The upload photo page has a cgi form that after the photo is successfully uploaded takes the client to a success page. Now the client is outside the filemaker database and I want to get them back in. The question: What is the best way to get allow the client back into their records page without having them resign in or press the back button a number of times? I would like to have two buttons on the success page that allows the client to go to the new order page or return to their home page. Is setting a cookie the answer (I have heard that they don't always work)? Each client has a unique id number. Thanks in advance for your help - Sam
Garry Claridge Posted October 27, 2002 Posted October 27, 2002 I think a Cookie would work OK. Another method is to pass the ID through the cgi. You can use a little bit of Javascript to retrieve the Cookie when returning to the database. All the best. Garry
Sam Laundon Posted October 28, 2002 Author Posted October 28, 2002 Thanks Gary I don't know how to do the Javascript so let's stick with the Cookie. Here is what I have used, but it does not work as of yet: FMPro?-DB=database&-Format=home.htm&-cookie=clientid&-Max=1&-Find" I have set the cookie and see in IE preferences/cookies that the cookie is there, but it is not being shown in the "cookie=clientid". I probably have it wrong. What should the syntac be. Thanks once again for your help - Sam
Garry Claridge Posted October 28, 2002 Posted October 28, 2002 Sam, Two FM tags are used: [FMP-SetCookie] and [FMP-Cookie] You say that you are setting the Cookie OK. So to read the Cookie you would use this: FMPro?-DB=database&-Format=home.htm&myfield=[FMP-Cookie: mycookie]&-Max=1&-Find That is if this URL is in a page. Good Luck. Garry
Sam Laundon Posted October 29, 2002 Author Posted October 29, 2002 Thanks Gary. But it is not working for me yet. Remeber I am outside of FMPro and am trying to get my client back in. The client has submitted a photo through the browser and I am trying to get them back in to the database. As I said I can see the cookie has been set but it is not showing up in " myfield=[FMP-Cookie: mycookie] ". Maybe this is a syntac problem. The cookies name is DrId and the field I am want the cookie to populate is dr_id. What I used in place of your example was "dr_id=[FMP-Cookie: DrId]. When I look at the code in the browser, no cookie value has be place in the code. Thanks again for your help - Sam
Garry Claridge Posted October 29, 2002 Posted October 29, 2002 This is where you need to use some Javascript. Retrive the Cookie with this: <script> var allcookies = document.cookie ; var pos = allcookies.indexOf("DrId=") ; if (pos != -1) { var start = pos + 5 ; var end = allcookies.indexOf(";",start) ; if (end == -1) end = allcookies.length ; var value = allcookies.substring(start, end) ; } else { var value = 1 ; } ; </script> </HEAD> Then apply it like this:<form action="FMPro" method="post"> . . <script> document.write('<input type="hidden" name="dr_id" value="' + value + '">'); </script> <input type="submit" name="-find" value="Click here when finished"> Hope this helps. Garry
Sam Laundon Posted October 30, 2002 Author Posted October 30, 2002 Hi Gary, Thanks for spending the time trying to explain this to me. I have taken the your code and placed it in the success.htm page, but it is still not retrieving the cookie. Is the cookie suppose to show up here: var pos = allcookies.indexOf("DrId=")? If so, nothing shows in (Drid=") What am I doing wrong? Here is what the success.htm page looks like: <html> <head> <meta http-equiv="content-type" content="text/html;charset=X-MAC-ROMAN"> <meta name="generator" content="Adobe GoLive 5"> <title>Thank You</title> <script> var allcookies = document.cookie ; var pos = allcookies.indexOf("DrId=") ; if (pos != -1) { var start = pos + 5 ; var end = allcookies.indexOf(";",start) ; if (end == -1) end = allcookies.length ; var value = allcookies.substring(start, end) ; } else { var value = 1 ; } ; </script> </HEAD> </head> <body bgcolor="#ffffff" background="paper_background.gif"> <div align="center"> <p><img src="logo.jpg" alt="" width="160" height="90" border="0"></p> <font face="Verdana,Times New Roman,Arial"><b>Thank you</b></font> <p><font color="#006400" face="Verdana,Times New Roman,Arial"><b>Your Upload is Complete</b></font></p> <div align="center"> <p><font size="2" color="black" face="Verdana,Times New Roman,Arial"><b>From there you can press Home to go to your Home page.</b></font></p> <p><font size="2" color="black" face="Verdana,Times New Roman,Arial"><b>Your will receive an e-mail confirmation of your order.</b></font></p> </div> <p></p> <form action="FMPro" method="post"> . . <script> document.write('<input type="hidden" name="dr_id" value="' + value + '">'); </script> <input type="hidden" name="-db" value="cases"> <input type="hidden" name="-format" value="home.htm"> <input type="submit" name="-find" value="Click here when finished"> <p></p> <p></p> </div> </body> </html> thanks again for your help.
Garry Claridge Posted October 30, 2002 Posted October 30, 2002 OK, test if it is reading the Cookie by placing this line in the page: <br>The Cookie value is: <script>document.write(value);</script><br> The Cookie is dependent on it being set, on a previous page, with this: [FMP-SetCookie: DrId=Field: dr_id, Expires=600] The "Expires" is the number of minutes the Cookie will live for. I have just remembered that I have had problems with Capital letters in Cookie names. So, change the name of the Cookie to "drid" from "DrId" (in both the SetCookie and the Javascript). All the best. Garry
Sam Laundon Posted October 31, 2002 Author Posted October 31, 2002 Thanks so much Gary. That finally did the trick. There is no way I could have figured this out without your help. Sam
Recommended Posts
This topic is 8128 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now