textarea中断mysql更新查询

sqyvllje  于 2021-06-25  发布在  Mysql
关注(0)|答案(1)|浏览(306)

我决定用input type=“text”交换一个textarea,因为这样更容易输入很多行文本。insert查询与textarea一起工作,但是update查询不再工作了,有什么想法吗?

<?php

$leerling_id = $_GET['id'];

//$rapportquery = "SELECT *, r.id as rapportid FROM dagrapportage d, leerling l, /*leerlingrapporten r,*/ gebruiker g WHERE l.id = r.leerling_id AND d.id = r.rapport_id AND d.last_edited_by = g.id AND r.leerling_id = '" . $leerling_id . "'";
$rapportquery = "SELECT * FROM dagrapportage WHERE leerling_id = '$leerling_id'";
$rapportresult = $db->query($rapportquery);

if (isset($_POST['submit_edit_rapport'])) {
    $wrating = $_POST['werkhouding_rating'];
    $drating = $_POST['docent_houding_rating'];
    $grating = $_POST['groepsgenote_houding_rating'];
    $crating = $_POST['conflicten_rating'];
    $frating = $_POST['feedback_rating'];
    $wdrating = $_POST['werkdoelen_rating'];

    $lesblok1 = $_POST['lesblok1'];
    $lesblok2 = $_POST['lesblok2'];
    $lesblok3 = $_POST['lesblok3'];
    $lesblok4 = $_POST['lesblok4'];
    $lesblok5 = $_POST['lesblok5'];
    $opmerking = $_POST['comment'];

    $added_date = date('Y-m-d');
    $edit_date = date('Y-m-d H:i:s');
    $edited_by = $user_id;
    $dagrapportage_edit_id = $_GET['id'];

    $rapporten = "UPDATE dagrapportage SET werkhouding = '$wrating', houding_docent = '$drating', houding_groepsgenoten = '$grating', omgang_conflicten = '$crating', omgang_feedback = '$frating', werkdoelen = '$wdrating', lesblok_1 = '$lesblok1', lesblok_2 = '$lesblok2', lesblok_3 = '$lesblok3', lesblok_4 = '$lesblok4', lesblok_5 = '$lesblok5', opmerkingen = '$opmerking', last_edited_date = '$edit_date', last_edited_by = '$edited_by' WHERE id = '$dagrapportage_edit_id'";
    echo $rapporten;
    $rapportenResult = $db->query($rapporten);
    $lastid = $db->lastInsertId();

//$leerlingrapporten = "INSERT INTO leerlingrapporten(rapport_id,leerling_id)VALUES('$lastid','$leerling_id')";
//$leerlingrapportenResult = $db->query($leerlingrapporten);
    //header('Location: ' . $_SERVER['HTTP_REFERER'] . '');

}

?>

以下是我尝试更新的表单:

<form class="form-horizontal addrapportform" id="editrapportform" role="form" name="editrapportform"
      method="post" action="">
    <fieldset class="starability-slot" id="werkhouding_rating">
        <legend>Werkhouding:</legend>
        <input type="radio" id="no-rate" class="input-no-rate"
               name="werkhouding_rating" value="0"
               aria-label="No rating."/>
        <input type="radio" id="werkhouding_rating1" name="werkhouding_rating"
               value="1" <?php if ($rapport['werkhouding'] == 1) { ?> checked <?php } ?>/>
        <label for="werkhouding_rating1" title="Dramatisch">1</label>
        <input type="radio" id="werkhouding_rating2" name="werkhouding_rating"
               value="2" <?php if ($rapport['werkhouding'] == 2) { ?> checked <?php } ?>/>
        <label for="werkhouding_rating2" title="Achteruit gegaan">2</label>
        <input type="radio" id="werkhouding_rating3" name="werkhouding_rating"
               value="3" <?php if ($rapport['werkhouding'] == 3) { ?> checked <?php } ?>/>
        <label for="werkhouding_rating3" title="Geen verbetering">3</label>
        <input type="radio" id="werkhouding_rating4" name="werkhouding_rating"
               value="4" <?php if ($rapport['werkhouding'] == 4) { ?> checked <?php } ?>/>
        <label for="werkhouding_rating4" title="Goed">4</label>
        <input type="radio" id="werkhouding_rating5" name="werkhouding_rating"
               value="5" <?php if ($rapport['werkhouding'] == 5) { ?> checked <?php } ?>/>
        <label for="werkhouding_rating5" title="Zeer goed">5</label>
    </fieldset>
    <fieldset class="starability-slot" id="docent_houding_rating">
        <legend>Houding naar docent:</legend>
        <input type="radio" id="no-rate" class="input-no-rate"
               name="docent_houding_rating"
               value="0" <?php if ($rapport['houding_docent'] == 0) { ?> checked <?php } ?>
               aria-label="No rating."/>
        <input type="radio" id="houdingd1" name="docent_houding_rating"
               value="1" <?php if ($rapport['houding_docent'] == 1) { ?> checked <?php } ?>/>
        <label for="houdingd1" title="Dramatisch">1</label>
        <input type="radio" id="houdingd2" name="docent_houding_rating"
               value="2" <?php if ($rapport['houding_docent'] == 2) { ?> checked <?php } ?>/>
        <label for="houdingd2" title="Achteruit gegaan">2</label>
        <input type="radio" id="houdingd3" name="docent_houding_rating"
               value="3" <?php if ($rapport['houding_docent'] == 3) { ?> checked <?php } ?>/>
        <label for="houdingd3" title="Geen verbetering">3</label>
        <input type="radio" id="houdingd4" name="docent_houding_rating"
               value="4" <?php if ($rapport['houding_docent'] == 4) { ?> checked <?php } ?>/>
        <label for="houdingd4" title="Goed">4</label>
        <input type="radio" id="houdingd5" name="docent_houding_rating"
               value="5" <?php if ($rapport['houding_docent'] == 5) { ?> checked <?php } ?>/>
        <label for="houdingd5" title="Zeer goed">5</label>
    </fieldset>

    <fieldset class="starability-slot" id="groepsgenote_houding_rating">
        <legend>Houding naar groepsgenoten:</legend>
        <input type="radio" id="no-rate" class="input-no-rate"
               name="groepsgenote_houding_rating"
               value="0" <?php if ($rapport['houding_groepsgenoten'] == 0) { ?> checked <?php } ?>
               aria-label="No rating."/>
        <input type="radio" id="houdingg1" name="groepsgenote_houding_rating"
               value="1" <?php if ($rapport['houding_groepsgenoten'] == 1) { ?> checked <?php } ?>/>
        <label for="houdingg1" title="Dramatisch">1</label>
        <input type="radio" id="houdingg2" name="groepsgenote_houding_rating"
               value="2" <?php if ($rapport['houding_groepsgenoten'] == 2) { ?> checked <?php } ?>/>
        <label for="houdingg2" title="Achteruit gegaan">2</label>
        <input type="radio" id="houdingg3" name="groepsgenote_houding_rating"
               value="3" <?php if ($rapport['houding_groepsgenoten'] == 3) { ?> checked <?php } ?>/>
        <label for="houdingg3" title="Geen verbetering">3</label>
        <input type="radio" id="houdingg4" name="groepsgenote_houding_rating"
               value="4" <?php if ($rapport['houding_groepsgenoten'] == 4) { ?> checked <?php } ?>/>
        <label for="houdingg4" title="Goed">4</label>
        <input type="radio" id="houdingg5" name="groepsgenote_houding_rating"
               value="5" <?php if ($rapport['houding_groepsgenoten'] == 5) { ?> checked <?php } ?>/>
        <label for="houdingg5" title="Zeer goed">5</label>
    </fieldset>

    <fieldset class="starability-slot" id="conflicten_rating">
        <legend>Omgang met conflicten:</legend>
        <input type="radio" id="no-rate" class="input-no-rate"
               name="conflicten_rating"
               value="0" <?php if ($rapport['omgang_conflicten'] == 0) { ?> checked <?php } ?>
               aria-label="No rating."/>
        <input type="radio" id="omgangc1" name="conflicten_rating"
               value="1" <?php if ($rapport['omgang_conflicten'] == 1) { ?> checked <?php } ?>/>
        <label for="omgangc1" title="Dramatisch">1</label>
        <input type="radio" id="omgangc2" name="conflicten_rating"
               value="2" <?php if ($rapport['omgang_conflicten'] == 2) { ?> checked <?php } ?>/>
        <label for="omgangc2" title="Achteruit gegaan">2</label>
        <input type="radio" id="omgangc3" name="conflicten_rating"
               value="3" <?php if ($rapport['omgang_conflicten'] == 3) { ?> checked <?php } ?>/>
        <label for="omgangc3" title="Geen verbetering">3</label>
        <input type="radio" id="omgangc4" name="conflicten_rating"
               value="4" <?php if ($rapport['omgang_conflicten'] == 4) { ?> checked <?php } ?>/>
        <label for="omgangc4" title="Goed">4</label>
        <input type="radio" id="omgangc5" name="conflicten_rating"
               value="5" <?php if ($rapport['omgang_conflicten'] == 5) { ?> checked <?php } ?>/>
        <label for="omgangc5" title="Zeer goed">5</label>
    </fieldset>

    <fieldset class="starability-slot" id="feedback_rating">
        <legend>Omgang met feedback:</legend>
        <input type="radio" id="no-rate" class="input-no-rate"
               name="feedback_rating"
               value="0" <?php if ($rapport['omgang_feedback'] == 0) { ?> checked <?php } ?>
               aria-label="No rating."/>
        <input type="radio" id="omgangf1" name="feedback_rating"
               value="1" <?php if ($rapport['omgang_conflicten'] == 1) { ?> checked <?php } ?>/>
        <label for="omgangf1" title="Dramatisch">1</label>
        <input type="radio" id="omgangf2" name="feedback_rating"
               value="2" <?php if ($rapport['omgang_conflicten'] == 2) { ?> checked <?php } ?>/>
        <label for="omgangf2" title="Achteruit gegaan">2</label>
        <input type="radio" id="omgangf3" name="feedback_rating"
               value="3" <?php if ($rapport['omgang_conflicten'] == 3) { ?> checked <?php } ?>/>
        <label for="omgangf3" title="Geen verbetering">3</label>
        <input type="radio" id="omgangf4" name="feedback_rating"
               value="4" <?php if ($rapport['omgang_conflicten'] == 4) { ?> checked <?php } ?>/>
        <label for="omgangf4" title="Goed">4</label>
        <input type="radio" id="omgangf5" name="feedback_rating"
               value="5" <?php if ($rapport['omgang_conflicten'] == 5) { ?> checked <?php } ?>/>
        <label for="omgangf5" title="Zeer goed">5</label>
    </fieldset>

    <fieldset class="starability-slot" id="werkdoelen_rating">
        <legend>Werkdoelen:</legend>
        <input type="radio" id="no-rate" class="input-no-rate"
               name="werkdoelen_rating"
               value="0" <?php if ($rapport['werkhouding'] == 0) { ?> checked <?php } ?>
               aria-label="No rating."/>
        <input type="radio" id="werkdoel1" name="werkdoelen_rating"
               value="1" <?php if ($rapport['werkhouding'] == 1) { ?> checked <?php } ?>/>
        <label for="werkdoel1" title="Dramatisch">1</label>
        <input type="radio" id="werkdoel2" name="werkdoelen_rating"
               value="2" <?php if ($rapport['werkhouding'] == 2) { ?> checked <?php } ?>/>
        <label for="werkdoel2" title="Achteruit gegaan">2</label>
        <input type="radio" id="werkdoel3" name="werkdoelen_rating"
               value="3" <?php if ($rapport['werkhouding'] == 3) { ?> checked <?php } ?>/>
        <label for="werkdoel3" title="Geen verbetering">3</label>
        <input type="radio" id="werkdoel4" name="werkdoelen_rating"
               value="4" <?php if ($rapport['werkhouding'] == 4) { ?> checked <?php } ?>/>
        <label for="werkdoel4" title="Goed">4</label>
        <input type="radio" id="werkdoel5" name="werkdoelen_rating"
               value="5" <?php if ($rapport['werkhouding'] == 5) { ?> checked <?php } ?>/>
        <label for="werkdoel5" title="Zeer goed">5</label>
    </fieldset>

    <div class="rapportage-row">
        <div class="col-sm-6">
            <h4>Lesblok 1:</h4>
        </div>
        <div class="col-sm-6 p-l-n">
            <textarea style="resize: vertical; width: 100%;" form="dagrapportage-form" class="form-control" rows="1" name="lesblok1"><?php print $rapport['lesblok_1']; ?></textarea>
        </div>
        <div class="clear"></div>
    </div>
    <div class="rapportage-row">
        <div class="col-sm-6">
            <h4>Lesblok 2:</h4>
        </div>
        <div class="col-sm-6 p-l-n">
            <textarea style="resize: vertical; width: 100%;" form="dagrapportage-form" class="form-control" rows="1" name="lesblok2"><?php print $rapport['lesblok_2']; ?></textarea>
        </div>
        <div class="clear"></div>
    </div>
    <div class="rapportage-row">
        <div class="col-sm-6">
            <h4>Lesblok 3:</h4>
        </div>
        <div class="col-sm-6 p-l-n">
            <textarea style="resize: vertical; width: 100%;" form="dagrapportage-form" class="form-control" rows="1" name="lesblok3"><?php print $rapport['lesblok_3']; ?></textarea>
        </div>
        <div class="clear"></div>
    </div>
    <div class="rapportage-row">
        <div class="col-sm-6">
            <h4>Lesblok 4:</h4>
        </div>
        <div class="col-sm-6 p-l-n">
            <textarea style="resize: vertical; width: 100%;" form="dagrapportage-form" class="form-control" rows="1" name="lesblok4"><?php print $rapport['lesblok_4']; ?></textarea>
        </div>
        <div class="clear"></div>
    </div>
    <div class="rapportage-row">
        <div class="col-sm-6">
            <h4>Lesblok 5:</h4>
        </div>
        <div class="col-sm-6 p-l-n">
            <textarea style="resize: vertical; width: 100%;" form="dagrapportage-form" class="form-control" rows="1" name="lesblok5"><?php print $rapport['lesblok_5']; ?></textarea>
        </div>
        <div class="clear"></div>
    </div>
    <div class="rapportage-row">
        <div class="col-sm-6">
            <h4>Opmerkingen:</h4>
        </div>
        <div class="col-sm-6 p-l-n">
            <textarea style="resize: vertical; width: 100%;" form="dagrapportage-form" class="form-control" rows="5" name="comment" ><?php print $rapport['opmerkingen']; ?></textarea>
        </div>
        <div class="clear"></div>
    </div>

    <input class="btn btn-primary" type="submit" name="submit_edit_rapport">

</form>

所有的星星(单选按钮)都在工作,只是文本区域似乎不再工作了!有人知道解决办法吗?

1cklez4t

1cklez4t1#

我忘了更改textarea中的form属性,很抱歉这个愚蠢的问题!

相关问题