I’ve got the following route:
register_invitecode:
url: /register/:invitecode
param: { module: home, action: register }
register:
url: /register
param: { module: home, action: register }
I want to use the “invitecode” in a partial, _form.php but I can’t get the $_GET[‘invitecode’]. I’ve used the following code:
<?php echo $sf_request->getGetParameter('invitecode') ?>
It doesn’t give me any error, but it also doesn’t show me the invitecode.
What can I do?
Also, is there any way to avoid the double declaration of the “register” route? invitecode should be an optional parameter, not mandatory.
the Get parameters (
sfWebRequest->getGetParameter()) are the parameters that are the “physical” parameters of the HTTP GET operation. In a HTTP GET all parameters are added to the querystring (?invitecode=abcd).If you want to access the parameters from the routing (like in your case), you have to use the
sfWebRequest->getParameter().