-5

わかりましたので、このコードを作成しました:

Acum adaugati note si absente pentru&nbsp;<?php echo $numeleelevuluiales ?>, la materia <?php echo $numelemateriei ?> :
<br />
<?php
if(!isset($_POST['submit13']))
{
    ?>
    Adauga o nota noua:

    <form method="post" action="" name="form666">
    <table border="0" cellspacing="0" cellpadding="0"> 
      <tr>

        <td  width="50">Nota: &nbsp;

        <select name="note">
    <option value="eroare">Alege nota</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">9</option>
    <option value="10">10</option>
    </select>
    </td>
    <td   width="50"> Ziua:&nbsp;
    <select name="ziua">
    <option value="eroare1">Alege ziua</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">9</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    </select>

    </td>
    <td   width="50">Luna: &nbsp;
    <select name="luna">
    <option value="eroare2">Alege luna</option>

    <?php
    $lunile = "SELECT id, luni
        FROM luni";
    $qlunile = mysql_query($lunile);

    while($luniletabel = mysql_fetch_array($qlunile))
    {
        echo "<option value='".$luniletabel['id']."' name='luna'>" . $luniletabel['luni'] . "</option>";
    }
     ?>
    </select>

    </td></tr>

      </table> <br />
         <input type="submit" name="submit13" value="&nbsp;Adauga &nbsp;" >
         </form><br />
    <?php

}//sfarsit if
else
{
    if(!isset($_POST['submit333']))
    {
        if($_POST['note'] == 'eroare' || $_POST['ziua'] == 'eroare1' || $_POST['luna'] == 'eroare2' )
        {
            echo "EROARE!!! Nu ati ales toate campurile <br />";
        }
        else
        {
            echo "Ati ales nota&nbsp;" .$_POST['note'].", in ziua&nbsp;" .$_POST['ziua']. ", si luna a " .$_POST['luna']. ".";
            ?><br />
            Daca datele sunt corecte, apasati butonul de mai jos pentru adaugarea in baza de date:


             <form method="post" action="" name="form666">
             <input type="submit" name="submit333" value="&nbsp;Adauga in baza de date&nbsp;" >
                 </form>
            <?php
        }
    }
    else // daca a fost apasat submit 333
    {
        $azi = new DateTime(date("Y-m-d"));
        //
        $data_adaugare = $azi->format("Y-m-d");
        //
        // se adauga cele 2 zile
        //
        $termen = 2; // zile de modificare
        //
        $azi->add(new DateInterval('P2D'));
        //
        $data_expirarii = $azi->format("Y-m-d");

        $materianote = $_SESSION['materienote'];
        $id_note = $_POST['note'];
        $data_nota = $_POST['ziua'];
        $luna_nota = $_POST['luna'];
        echo $id_note;

        mysql_query("INSERT INTO note(id_elev, id_materie, id_note, data_nota, luna_nota, data_adaugare, data_expirare) 
                VALUES ($codul_elevului, $materianote, $id_note, $data_nota, $luna_nota, $data_adaugare, $data_expirarii) ")
                or die("Hopa! Ceva nu merge!");
        echo "Adaugat cu succes!";


    }//sfarsit if isset submit 333

}//sfarsit daca sunt alese toate campurile


}

問題はここelse // daca a fost apasat submit 333 にあります。「submit333」送信ボタンを押しても、他に何も機能しません。else ステートメントで何かをエコーし​​ようとしましたが、何も機能しません。

何か案は?私は何を間違えましたか?

MySqlは大丈夫です。答えてくれてありがとう!

4

1 に答える 1