Php 将表单操作设置为jquery选项卡

Php 将表单操作设置为jquery选项卡,php,forms,jquery-ui,tabs,jquery-tabs,Php,Forms,Jquery Ui,Tabs,Jquery Tabs,我在我的网页上安装了一个jQueryUITabs系统,但是我遇到了一系列问题,其中一个问题是:我可以在同一个网页上向我的PhP发出表单请求,然后自己处理结果。 换句话说:我想将相关表单的操作设置为同一个选项卡,通过ajax从另一个文件加载,该选项卡首先包含表单,因此它可以读取并显示包含搜索结果的表 以下是一些代码,希望对您有所帮助 索引(包括#tabs div): 菲南塞罗 $(函数(){ $(“#制表符”)。制表符({ ajaxOptions:{ 错误:函数(xhr、状态、索引、锚定){ $

我在我的网页上安装了一个jQueryUITabs系统,但是我遇到了一系列问题,其中一个问题是:我可以在同一个网页上向我的PhP发出表单请求,然后自己处理结果。 换句话说:我想将相关表单的操作设置为同一个选项卡,通过ajax从另一个文件加载,该选项卡首先包含表单,因此它可以读取并显示包含搜索结果的表

以下是一些代码,希望对您有所帮助

索引(包括#tabs div):


菲南塞罗
$(函数(){
$(“#制表符”)。制表符({
ajaxOptions:{
错误:函数(xhr、状态、索引、锚定){
$(anchor.hash).html(
“一张卡雷加达·奥伊斯塔索布·曼努滕ão,德斯库佩·奥特兰斯托诺的标签。”);
}
}
});
});
这里是我放在选项卡下的表单之一(financeiro_ver.php文件):


菲南塞罗
GRUPO:
行政绝望
进口
班克斯
德斯帕斯矩阵
奥特罗斯
佩罗多:
判定元件:
地址:

你可以换一条线

            document.getElementById('fragment-1a').innerHTML = "changed";

我真的很兴奋,因为这是我在这个网站上的一些人的第一个工作答案,所以请告诉我它是否有效

一个完整的JAVASCRIPT NOOB如何找到您的答案的长篇大论

作为一个想法,您可以尝试这样做,以便tabs事件更改设置,即

但是这对你有什么影响呢我在这里发现了一些别的东西

这是一个基于事件的表单操作,您只能更改它

但现在有一个例子将两者结合在一起


请注意,您需要一个默认操作才能使表单正常工作
<?php
include 'all.php';

if (isset($_POST['efetuar'])) {
    $saida = new Saida();
    if (isset($_POST['situacao'])) {
        $saida->situacao = $_POST['situacao'];
    } else {
        $saida->situacao = 'npago';
    }
    $sql = "UPDATE financeiro SET situacao = '".$saida->situacao."' WHERE id = '".$_POST['saidaId']."'";
     mysql_query($sql);
}

if (!isset($_SESSION)) {
    session_start();
}
$_SESSION['ID_FUNCIONARIO'] = 46;
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html" charset="iso-8859-1" />
        <link type="text/css" href="css/smoothness/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />
        <link rel="stylesheet" type="text/css" href="css.css"></link>
        <title>Financeiro</title>
    </head>

    <body>
        <form id="form0" name="form0" method="post" action="financeiro_ver.php"> <!--action="http://sim.medgoldman.com.br/financeiro/financeiro_ver.php" style="background-color:#EEEEEE"> -->
              <table border="0" align="center" cellpadding="10" cellspacing="0">
                <tr>
                    <td align="center">GRUPO:
                        <select name="categoria" id="produto">
                            <option value="adm">Despesas Administrativas</option>
                            <option value="imp">Importações</option>
                            <option value="ban">Bancos</option>
                            <option value="matriz">Despesas Matriz</option>
                            <option value="outros">Outros</option>                            
                        </select></td>
                    <td align="center">PERÍODO:
                    <td>de: <input name="data1" id="data1" value=""></input></td>
                    <td>até: <input name="data2" id="data2" value=""></input></td>
                    </select></td>
                    <td align="center"><input name="buscar" type="submit" id="buscar" value="   Buscar   " /></td>
                </tr>
            </table>
        </form>
        <?php
        if ($_SESSION['ID_FUNCIONARIO'] == '19') {
            echo '<form name="form2" method="post" <!--action="http://sim.medgoldman.com.br/financeiro/financeiro_ver.php" --> style="background-color:#EEEEEE">';
        }
        ?>
        <table  class ="viewTable" align="center">
            <?php
            if (isset($session->message)) {

                $mens ="<th>" . $session->message . "</th>";
                echo utf8_encode($mens);
            }

            if (isset($_POST['buscar'])) {

                $query = "SELECT * FROM financeiro " .
                        "WHERE categoria = '" . $_POST['categoria'] .
                        "' AND data >= '" . $_POST['data1'] .
                        "' AND data <= '" . $_POST['data2'] . "'";

                if (mysql_query($query, $database->connection)) {
                    $categoriaSel = mysql_query($query, $database->connection);

                    $output = '<tr><th colspan="3">Categoria ';
                    if ($_POST['categoria'] === 'adm') {
                        $output .= "Despesas administrativas";
                    } elseif ($_POST['categoria'] === 'imp') {
                        $output .= "Importações";
                    } elseif ($_POST['categoria'] === 'ban') {
                        $output .= "Bancos";
                    } elseif ($_POST['categoria'] === 'outros') {
                        $output .= "Outros";
                    } elseif ($_POST['categoria'] === 'matriz') {
                        $output .= "Despesas Matriz";
                    }
                    $output .= "</th>";
                    $output .= "<tr><th>Data</th><th>Descrição</th><th>Valor</th></tr>";

                    $valorSomaUS = 0;
                    $valorSomaRS = 0;

                    while ($saidasSel = mysql_fetch_array($categoriaSel)) {
                        $valorDisplay = number_format($saidasSel['valor'], '2', ',', '.');
                        $output .= "<tr";
                        if ($saidasSel['situacao'] === 'pago') {
                            $output .= ' class="pago"';
                        } else if ($saidasSel['situacao'] === 'npago') {
                            $output .= ' class="npago"';
                        }
                        $output .= ">";
                        $output .= "<td class=\"datout\">" . $saidasSel['data'] . "</td>";
                        $output .= "<td class=\"desout\">" . $saidasSel['descricao'] . "</td>";
                        if ($saidasSel['cambio'] === "us") {
                            $output .= "<td class=\"valout\"> U$ " . $valorDisplay . "</td>";
                            $valorSomaUS += $saidasSel['valor'];
                        } else {
                            $output .= "<td class=\"valout\"> R$ " . $valorDisplay . "</td>";
                            $valorSomaRS += $saidasSel['valor'];
                        }

                        //VERIFICA USUARIO PARA ADICIONAR PAGO/NPAGO:
                        if ($_SESSION['ID_FUNCIONARIO'] == '19') {
                            $output .= '<td><input name="situacao" type="checkbox" value="pago"';
                            if ($saidasSel['situacao'] === 'pago') {
                                $output .= ' checked';
                            }
                            $output .=">Pago</input></td>";
                        }

                        //VERIFICA USUARIO PARA VER PAGO/NPAGO:
                        if ($_SESSION['ID_FUNCIONARIO'] == '46') {
                            if ($saidasSel['situacao'] === 'pago') {
                                $output .= '<td>pago</td>';
                            } else {
                                $output .= '<td>não pago</td>';
                            }
                        }
                        if ($_SESSION['ID_FUNCIONARIO'] == '30' && $saidasSel['categoria'] === "imp") {
                            if ($saidasSel['situacao'] === 'pago') {
                                $output .= '<td>pago</td>';
                            } else {
                                $output .= '<td>não pago</td>';
                            }
                        }

                        //VERIFICA USUARIO PARA ADICIONAR DELETAR:                   
                        if (($_SESSION['ID_FUNCIONARIO'] == '46') && ($saidasSel['categoria'] === 'adm' || $saidasSel['categoria'] === 'outros' || $saidasSel['categoria'] === 'matriz')) {

                            $output .= "<td><button class=\"deletar\" href=\"financeiro_deletar.php?id=" . $saidasSel['id'] . "\">Deletar</button>";
                        } elseif (( $_SESSION['ID_FUNCIONARIO'] == '30' || $_SESSION['ID_FUNCIONARIO'] == '46' ) && $saidasSel['categoria'] === 'imp') {

                            $output .= "<td><button class=\"deletar\" href=\"financeiro_deletar.php?id=" . $saidasSel['id'] . "\">Deletar</button></td>";
                        }

                        $output .="</tr>";

//SOMA DOS VALORES DO PERIODO:                                  
                        $valorSomaUS = number_format($valorSomaUS, '2', ',', '.');
                        $valorSomaRS = number_format($valorSomaRS, '2', ',', '.');
                        $output .= "<tr> <td class=\"valsoma\" colspan=\"3\"> Soma do período = R$ " . $valorSomaRS . " e U$ " . $valorSomaUS . "</td></tr>";
                        if ($_SESSION['ID_FUNCIONARIO'] == '19') {
                            $output .= '<tr><td><input id="efetuar" type="submit" value=" Efetuar " name="efetuar"></input></td><td><input type="hidden" value="' . $saidasSel['id'] . '" name="saidaId"></input></td></tr>';
                        }
                    }
                    echo utf8_encode($output);
                } else {
                    $session->message("Nenhuma saída para este período.");
                }
            }
            ?>
        </table>
        <?php
        if ($_SESSION['ID_FUNCIONARIO'] == '19') {
            echo '</form>';
        }
        ?>
    </body>
</html>
$(document).ready(function() {
// Tab initialization
// This is setup for two tab groups and is not needed
$('#tabs, #fragment-1').tabs({
    select: function(event, ui){
        var tabNumber = ui.index;
        var tabName = $(ui.tab).text();
        //Here I setup an event for each change this changes some inner html 
        //of a tag but can be applied  in your situation
        if(tabNumber = 1 ) {
            document.getElementById('fragment-1a').innerHTML = "changed";
        } else {
        }
        //This was just some debuging code for me
        console.log('Tab number ' + tabNumber + ' - ' + tabName + ' - clicked');
    }
    });
});
            document.getElementById('fragment-1a').innerHTML = "changed";
        document.forms[0].action = "An Action";