2002 Posts in 1422 Topics by 616 members
|Go to End|
19 September 2009 at 5:33pm Last edited: 19 September 2009 5:36pm
When I call a user defined form I pass a variable in the URL www.blah.com/contactform?mfid=4
I want to use this variable within the UserDefinedForm.php to enable me to change what attachment gets sent with the response to the submitter i.e. want to add this (at about line 400)
$fn = DataObject::get_by_id("MonkeysFist", $_GET['mfid']);
if(!$fn) return false;
$filepath = "assets/Uploads/mf_attachments/$fn->MFFileName";
At the moment $_GET['mfid'] returns no value and I am wondering how I can pass it into this script?
I know I should not be necessarily adding it to this file as it would become an upgrade issue but I am no worrying about that at the moment. I just want to see if I can get it to work.
How do I go about this?
22 September 2009 at 9:39pm
Any thoughts on this. I still can't see a way to do it?
1 October 2009 at 4:08pm
Have you tried using
Director::urlParams[â€™mfidâ€™] or $_REQUEST['mfid']
instead of $_GET ?
8 November 2009 at 12:52pm
Thanks for this suggestion.
I am having problem implementing it though. I am trying to use
$fn = DataObject::get_by_id("MonkeysFist", $mfid);
I get Parse error: syntax error, unexpected '[' in ... for the first line
Can anyone tell me why I can't use [ ?
|Go to Top|