Ron Record Posted April 28, 2020 Share Posted April 28, 2020 I have added an element to the Nav Bar which when clicked brings up a Custom Page with a template I wrote that presents the user with a form. What is the best/recommended method of retrieving the form data when the user clicks the Submit button? For example, my template includes a field for the user's first name as follows: <input type="text" name="firstname" id="inputFirstName" value="{$clientfirstname}"{if in_array('firstname', $uneditablefields)} disabled="disabled"{/if} class="form-control" /> Is there an easier WHMCS way of retrieving the user's first name as entered on the template form other than the typical PHP way of something like: // Check if the form is submitted if ( isset( $_POST['submit'] ) ) { // retrieve the form data by using the element's name attributes value as key $firstname = $_REQUEST['firstname']; Or, is it the case that $clientfirstname is passed back to the custom page along with the other form variable values? Thanks for any help - I am fairly new to WHMCS so feel free to treat me like a child 🙂 0 Quote Link to comment Share on other sites More sharing options...
Ron Record Posted May 3, 2020 Author Share Posted May 3, 2020 No responses to my question but I have sufficiently resolved this. At least to my current satisfaction. The answer is yes, you can utilize typical PHP way of retrieving form data. Something like: if ($action == "someactionthetemplateset") { Â Â Â Â Â Â $ca->setTemplate('sometemplateyouwant'); Â Â Â Â Â Â $ca->addToBreadCrumb("companyuserdetails.php?action=someactionthetemplateset", Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'Add Company User'); Â Â Â Â Â Â $firstname = isset($_POST['firstname']) ? $_POST['firstname'] : ''; And so on for the values from the form in the template. There may be some $whmcs magic that is available to the module or hook in retrieving form data or variable values from a template but I do not find it in the documentation so for now I am just using something like the above. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.