php - Using forms from a tabbed index page -
so i'm new php , i'm having trouble getting of forms function. think may way site set that's causing me problems.
i have index.php set such:
<div class="pagecontent"> <div id="main" style="width:1000px; margin:0 auto;"> <!-- create tabs --> <div id="tabs" > <ul> <li><a href="#tabs-0">overview</a></li> <li><a href="#tabs-1">ranked</a></li> <li><a href="#tabs-2">arena</a></li> <li><a href="#tabs-3">decks</a></li> <li><a href="#tabs-4">new game</a></li> <li><a href="#tabs-5">admin</a></li> </ul> <div id="tabs-0"></div> <div id="tabs-1"></div> <div id="tabs-2"></div> <div id="tabs-3"></div> <div id="tabs-4"></div> <div id="tabs-5"></div> </div> <!-- load pages tabs --> <script> $("#tabs").tabs(); $("#tabs-0").load("tab0.php"); $("#tabs-1").load("tab1.php"); $("#tabs-2").load("tab2.php"); $("#tabs-3").load("tab3.php"); $("#tabs-4").load("newgame.php"); $("#tabs-5").load("admin.php"); </script> </div><!-- / main --> </div><!-- / pagecontent -->
this gives me nice static page , 6 tabs of .php
files cool stuff on.
there couple of forms, log in , such, in index.php
function fine. when create form on page in tab, not.
here's example admin.php
(#tabs-5
)
<?php if(isset($_post['dellog'])){ unlink('log.txt'); echo 'success'; } if(isset($_post['dellog'])){ unlink('error_log'); echo 'success'; } ?> <html> <head> </head> <body> <table width="100%" border="1"> <tr> <td width="40%" valign="top"> </td> <td width="30%" valign="top"> <h1>error_log</h1> <form action="" method="post"> <input type="submit" name="delerr" id="delerr" value="delete" /> </form> <hr /> <?php $lines = explode("\n", file_get_contents('error_log')); foreach ($lines $line){ echo $line.'<br>'; } ?> </td> <td width="3'0%" valign="top"> <h1>log.txt</h1> <form action="" method="post"> <input type="submit" name="dellog" id="dellog" value="delete" /> </form> <hr /> <?php $lines = explode("\n", file_get_contents('log.txt')); foreach ($lines $line){ echo $line.'<br>'; } ?> </td> </tr> </table> </body> </html>
this another, better example. stripped down test did yesterday question
<?php define('include_check',true); include 'php/functions.php'; error_reporting(e_all); ini_set('display_errors',1); logthis('ready!'); if (isset($_post['submit'])) { logthis('success'); } ?> <html> <head> </head> <body> <form method="post" action=""> <input type="submit" name="submit" id="submit" value="submit" /> </form> </body> </html>
neither of these examples work. when submit button pressed site refreshes no php actions taking place. there no error message in error_log. don't think it's getting call @ all.
neither of forms return output, 1 adds database. other deletes log files.
hope i've provided enough details.
what ever trying not possible @ all. can not load php code frontend, can processed server.
the statement $("#tabs-5").load("admin.php");
fetching html code (processed server) not php script
Comments
Post a Comment