AffordableDomainsCanada Posted July 6, 2020 Share Posted July 6, 2020 Hello WHMCS community, I have created a form for generating rDNS request. As yo can see by the 2 tpl files ive posted, I have to form working, all but the $message section. How can I get the results from my generator/form to be posted in the $message section when a ticket is created? So this file is the actual form, which the user will place their inputs, <html> <body> Hello{if $loggedin} {$clientname},{else},{/if}<br /> Please use the rDNS Generator below to create your rDNS records! <br /><br /> <form action="../rDNS_complete.php" method="get"> Main IP Address: <input name="ip1-1" type="text" size="3" maxlength="3"> . <input name="ip1-2" type="text" size="3" maxlength="3"> . <input name="ip1-3" type="text" size="3" maxlength="3"> . <input name="ip1-4" type="text" size="3" maxlength="3"> <br> URL: <input name="url1" type="text" size="30"><br><br> IP Address #2: <input name="ip2-1" type="text" size="3" maxlength="3"> . <input name="ip2-2" type="text" size="3" maxlength="3"> . <input name="ip2-3" type="text" size="3" maxlength="3"> . <input name="ip2-4" type="text" size="3" maxlength="3"> <br> URL: <input name="url2" type="text" size="30"><br><br> IP Address #3: <input name="ip3-1" type="text" size="3" maxlength="3"> . <input name="ip3-2" type="text" size="3" maxlength="3"> . <input name="ip3-3" type="text" size="3" maxlength="3"> . <input name="ip3-4" type="text" size="3" maxlength="3"> <br> URL: <input name="url3" type="text" size="30"> <br><br> IP Address #4: <input name="ip4-1" type="text" size="3" maxlength="3"> . <input name="ip4-2" type="text" size="3" maxlength="3"> . <input name="ip4-3" type="text" size="3" maxlength="3"> . <input name="ip4-4" type="text" size="3" maxlength="3"> <br> URL: <input name="url4" type="text" size="30"><br><br> IP Address #5: <input name="ip5-1" type="text" size="3" maxlength="3"> . <input name="ip5-2" type="text" size="3" maxlength="3"> . <input name="ip5-3" type="text" size="3" maxlength="3"> . <input name="ip5-4" type="text" size="3" maxlength="3"> <br> URL: <input name="url5" type="text" size="30"><br><br> <br> <center><button type="submit" class="btn btn-primary">Generate rDNS records</button></center> </form> </body> </html> This next tpl file is the output/results from the above file. When the button on the bottom is clicked it also tells the ticket which deptid, etc.. but I cannot get the results from my form in the message section of the ticket. Any help would be greatly appreciated. <html> <body> <form method="post" action="submitticket.php?step=3" enctype="multipart/form-data"> <input type="hidden" name="deptid" value="011" /> <input type="hidden" name="name" size="30" value="{$name}" /></td> <input type="hidden" name="email" size="50" value="{$email}" /></td> <input type="hidden" name="subject" size="60" value="rDNS Submission" /></td> {if $capatacha}{$LANG.imagecheck}[img=includes/verifyimage.php] <input type="text" name="code" size="10" maxlength="5" />{/if} <div class="alert alert-info"> <strong>Completed!</strong> You will find the results of your rDNS request below. Use the 'Open NEW Support Ticket' to get your rDNS records installed on your server. </div> <br> <div class="well"> <?php echo $_GET["ip1-4"]; ?>.<?php echo $_GET["ip1-3"]; ?>.<?php echo $_GET["ip1-2"]; ?>.<?php echo $_GET["ip1-1"]; ?>.in-addr.arpa. IN PTR <?php echo $_GET["url1"]; ?>.</br> <?php echo $_GET["ip2-4"]; ?>.<?php echo $_GET["ip2-3"]; ?>.<?php echo $_GET["ip2-2"]; ?>.<?php echo $_GET["ip2-1"]; ?>.in-addr.arpa. IN PTR <?php echo $_GET["url2"]; ?>.</br> <?php echo $_GET["ip3-4"]; ?>.<?php echo $_GET["ip3-3"]; ?>.<?php echo $_GET["ip3-2"]; ?>.<?php echo $_GET["ip3-1"]; ?>.in-addr.arpa. IN PTR <?php echo $_GET["url3"]; ?>.</br> <?php echo $_GET["ip4-4"]; ?>.<?php echo $_GET["ip4-3"]; ?>.<?php echo $_GET["ip4-2"]; ?>.<?php echo $_GET["ip4-1"]; ?>.in-addr.arpa. IN PTR <?php echo $_GET["url4"]; ?>.</br> <?php echo $_GET["ip5-4"]; ?>.<?php echo $_GET["ip5-3"]; ?>.<?php echo $_GET["ip5-2"]; ?>.<?php echo $_GET["ip5-1"]; ?>.in-addr.arpa. IN PTR <?php echo $_GET["url5"]; ?>.</br> </div> </br></br> <center><button type="submit" class="btn btn-success">Open NEW Suport Ticket</button></center> </body> </html> ALSO! on the rDNS Complete page, is it possible to have the user select a related product? I see when a ticket is opened there is a dropdown menu for "Related Service". How can the user select this prior to the step=3 page of opening a ticket ?? Thank you for taking the time to look into this issue, if you see any other issues regarding this form, and any ideas on how it can be improved would be great! I hate manually creating these rDNS request that are being submitted. so I figured if my clients were able to fill out a quick form and have it submitted via a ticket, it could save me hours every week! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 7, 2020 Share Posted July 7, 2020 18 hours ago, AffordableDomainsCanada said: How can I get the results from my generator/form to be posted in the $message section when a ticket is created? assuming there are two WHMCS .php files behind these templates, then ideally you should be doing it in the second .php file (the one that receives the submission), e.g consolidate your submitted variables into a string and pass that string back to the template as a variable for use in the output and hidden form submission. 18 hours ago, AffordableDomainsCanada said: This next tpl file is the output/results from the above file. When the button on the bottom is clicked it also tells the ticket which deptid, etc.. but I cannot get the results from my form in the message section of the ticket. Any help would be greatly appreciated. if you *really* had to, you could do it in the second template using Smarty (and remove the need for <?php ... <html> <body> <form method="post" action="submitticket.php?step=3" enctype="multipart/form-data"> <input type="hidden" name="deptid" value="011" /> <input type="hidden" name="name" size="30" value="{$name}" /></td> <input type="hidden" name="email" size="50" value="{$email}" /></td> <input type="hidden" name="subject" size="60" value="rDNS Submission" /></td> <input type="hidden" name="message" size="60" value="{$smarty.get.ip14}.{$smarty.get.ip13}.{$smarty.get.ip12}.{$smarty.get.ip11}.in-addr.arpa. IN PTR {if $smarty.get.url1}{$smarty.get.url1}{/if} {if $smarty.get.ip21}{$smarty.get.ip24}.{$smarty.get.ip23}.{$smarty.get.ip22}.{$smarty.get.ip21}.in-addr.arpa. IN PTR{/if} {if $smarty.get.url2}{$smarty.get.url2}{/if} {if $smarty.get.ip31}{$smarty.get.ip34}.{$smarty.get.ip33}.{$smarty.get.ip32}.{$smarty.get.ip31}.in-addr.arpa. IN PTR{/if} {if $smarty.get.url3}{$smarty.get.url3}{/if} {if $smarty.get.ip41}{$smarty.get.ip44}.{$smarty.get.ip43}.{$smarty.get.ip42}.{$smarty.get.ip41}.in-addr.arpa. IN PTR{/if} {if $smarty.get.url4}{$smarty.get.url4}{/if} {if $smarty.get.ip51}{$smarty.get.ip54}.{$smarty.get.ip53}.{$smarty.get.ip52}.{$smarty.get.ip51}.in-addr.arpa. IN PTR{/if} {if $smarty.get.url5}{$smarty.get.url5}{/if}" /></td> </td> {if $capatacha}{$LANG.imagecheck}[img=includes/verifyimage.php] <input type="text" name="code" size="10" maxlength="5" />{/if} <div class="alert alert-info"> <strong>Completed!</strong> You will find the results of your rDNS request below. Use the 'Open NEW Support Ticket' to get your rDNS records installed on your server. </div> <br> <div class="well"> {$smarty.get.ip14}.{$smarty.get.ip13}.{$smarty.get.ip12}.{$smarty.get.ip11}.in-addr.arpa. IN PTR</br> {if $smarty.get.url1}{$smarty.get.url1}</br>{/if} {if $smarty.get.ip21}{$smarty.get.ip24}.{$smarty.get.ip23}.{$smarty.get.ip22}.{$smarty.get.ip21}.in-addr.arpa. IN PTR</br>{/if} {if $smarty.get.url2}{$smarty.get.url2}</br>{/if} {if $smarty.get.ip31}{$smarty.get.ip34}.{$smarty.get.ip33}.{$smarty.get.ip32}.{$smarty.get.ip31}.in-addr.arpa. IN PTR</br>{/if} {if $smarty.get.url3}{$smarty.get.url3}</br>{/if} {if $smarty.get.ip41}{$smarty.get.ip44}.{$smarty.get.ip43}.{$smarty.get.ip42}.{$smarty.get.ip41}.in-addr.arpa. IN PTR</br>{/if} {if $smarty.get.url4}{$smarty.get.url4}</br>{/if} {if $smarty.get.ip51}{$smarty.get.ip54}.{$smarty.get.ip53}.{$smarty.get.ip52}.{$smarty.get.ip51}.in-addr.arpa. IN PTR</br>{/if} {if $smarty.get.url5}{$smarty.get.url5}</br>{/if} </div> </br></br> <center><button type="submit" class="btn btn-success">Open NEW Suport Ticket</button></center> </body> </html> for simplicity, i've removed the hyphens from the variable names in the first template.... and i'm ignoring all the </td> which I don't think need to be there in the second template. 18 hours ago, AffordableDomainsCanada said: ALSO! on the rDNS Complete page, is it possible to have the user select a related product? yes - though you'd have to generate the related service list yourself. 18 hours ago, AffordableDomainsCanada said: I see when a ticket is opened there is a dropdown menu for "Related Service". How can the user select this prior to the step=3 page of opening a ticket ?? you'd have to get a list of the services/domains of the loggedin user and generate the dropdown - ensuring that the service/domain IDs match the format used in the submitticket page, e.g Sid or Did and then pass the chosen value to step 3. and you might need to edit the steptwo template to ensure that when you pass the related service value to step 3, it selects it from the dropdown... <option value="{$relatedservice.id}" {if $smarty.get.relatedservice eq $relatedservice.id}selected{/if}> there's an argument that the second page button could link to the API to open the ticket in the bg - it all depends whether the user actually needs to be able to edit the ticket before submission. 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted July 8, 2020 Author Share Posted July 8, 2020 the client does not need to edit the ticket before it being submitted. right now they are basically submitting the ip address and url to me and I have to manually complete this task, so I figured it would be easy for my clients to fill the form out and the information in the ticket be correct from the get go and I can get someone at the data center to complete the rDNS request.. I was not sure how to connect to the API to pass all the calls through that way. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 8, 2020 Share Posted July 8, 2020 8 hours ago, AffordableDomainsCanada said: the client does not need to edit the ticket before it being submitted. then assuming you can find a way for the user to choose the service this applies to, it should remove the need for them to submit the ticket manually themselves. 8 hours ago, AffordableDomainsCanada said: right now they are basically submitting the ip address and url to me and I have to manually complete this task, so I figured it would be easy for my clients to fill the form out and the information in the ticket be correct from the get go and I can get someone at the data center to complete the rDNS request.. ignoring the related service issue on the first page, hopefully the above template changes gets you closer to automating that. 8 hours ago, AffordableDomainsCanada said: I was not sure how to connect to the API to pass all the calls through that way. well you'd have to pass a domain or service ID for it to make any sense, so getting that from the user would be the first step. I suppose that's either going to be a related service style dropdown, or maybe if the link to the first page was shown on the product/domain details page, then you could pass it's service/domain id to the rdns1 page and pass it along to the rdns2 page that does all the work. connection would be in the second php file and it requires four things (apart from service/domain ID - which is essential for your purpose I think) - action, deptid, subject and message - and by that stage, you know the action will be open ticket, dept id & subject will be passed from rdns1 and the message is just a string that need to be created from the passed values - much like I did in Smarty, though it's simpler in PHP. 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.