Ashleyfh Posted October 16, 2014 Share Posted October 16, 2014 HI there i am having trouble with some code hope someone can help, i have a webpage with in the page has 7 tabs, on the 7th tab is 3 button eavh one does something different, one will restart the server once pressed one turns it on and one off. soo when i press the button it all works just i need it to be able to stay on that tab and not refresh the page back to the first tab here is a sample of my code: <form method="post" action="{$smarty.server.PHP_SELF}?action=productdetails"> <input type="hidden" name="id" value="{$id}" /> <input type="submit" name="turnoff" value="Power Off"></form> </td> {php} if(isset($_POST['turnoff'])) { $customfield = $this->get_template_vars('customfield'); $RemoteReboot = explode(",", $customfield['value']); $mib = ".1.3.6.1.4.1.13742.4.1.2.2.1.3."; $mib = $mib.$RemoteReboot[1]; $community = "hjkuiouYUI23"; $result = snmpset($RemoteReboot[0], $community, $mib, i, "0"); #echo($result); } {/php} Quote Link to comment Share on other sites More sharing options...
gristoi Posted October 16, 2014 Share Posted October 16, 2014 you need to understand that submitting a form on a stateless page will refresh the page. You want to asynchrousnly submit the data ( submit without reloading the page ) . SO look at using ajax Quote Link to comment Share on other sites More sharing options...
Ashleyfh Posted October 16, 2014 Author Share Posted October 16, 2014 you need to understand that submitting a form on a stateless page will refresh the page. You want to asynchrousnly submit the data ( submit without reloading the page ) . SO look at using ajax Thanks for your answer, with ajax do you have to use it on seperate file and link it with my php ? 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.