变量搞砸了我的代码

时间:2014-05-02 13:21:05

标签: php forms variables

我终于让我的表单工作,因为我发现变量导致问题,但我不知道为什么他们是这样的问题。那么也许有人可以帮助我?

    <?php 
function displayForm( $errorMessages, $missingFields, $member ) {
displayPageHeader( "test" );

  if ( $errorMessages ) {
    foreach ( $errorMessages as $errorMessage ) {
      echo $errorMessage;
    }
  }


  $start = isset( $_REQUEST["start"] ) ? (int)$_REQUEST["start"] : 0;
?>
    <form action="view_member.php" method="post" style="margin-bottom: 50px;">
      <div style="width: 30em;">
        <table><tr>
        <td align="left"><input type="hidden" name="vervangingId" id="vervangingId" value="<?php echo $vervanging_id ?>" /></td>
        <td><input type="hidden" name="start" id="start" value="<?php echo $start ?>" /></td>
        </tr><tr>
        <td align="left"><label for="lesuur"<?php validateField( "lesuur", $missingFields ) ?> >Lesuur *</label></td>
        <td><input type="text" name="lesuur" id="lesuur" value="<?php echo $lesuur ?>" /></td>
        </tr><tr>
        <td align="left"><label for="datum"<?php validateField( "datum", $missingFields ) ?> >Datum *</label></td>
        <td><input type="text" name="datum" id="datum" value="<?php echo $datum ?>" /></td>
        </tr><tr>
        <td align="left"><label for="klasgroep"<?php validateField( "klasgroep", $missingFields ) ?> >Klasgroep *</label></td>
        <td><input type="text" name="klasgroep" id="klasgroep" value="<?php echo $klasgroep ?>" /></td>
        </tr><tr>
        <td align="left"><label for="leerkracht"<?php validateField( "leerkracht", $missingFields ) ?> >Leerkracht *</label></td>
        <td><input type="text" name="leerkracht" id="leerkracht" value="<?php echo $leerkracht ?>" /></td>
        </tr><tr>
        <td align="left"><label for="lokaal"<?php validateField( "lokaal", $missingFields ) ?> >Lokaal *</label></td>
        <td><input type="text" name="lokaal" id="lokaal" value="<?php echo $lokaal ?>" /></td>
        </tr><tr>
        <td align="left"><label for="vervanglokaal"<?php validateField( "vervanglokaal", $missingFields ) ?> >Vervanglokaal *</label></td>
        <td><input type="text" name="vervanglokaal" id="vervanglokaal" value="<?php echo $vervanglokaal ?>" /></td>
        </tr><tr>
        <td align="left"><label for="vervanger"<?php validateField( "vervanger", $missingFields ) ?> >Vervanger *</label></td>
        <td><input type="text" name="vervanger" id="vervanger" value="<?php echo $vervanger  ?>" /> </td>
        </tr><tr>
        <td align="left"><label for="omperking"<?php validateField( "omperking", $missingFields ) ?> >Opmerking *</label></td>
        <td><input type="text" name="omperking" id="omperking" value="<?php echo $opmerking ?>" /></td>
        </tr>
        </table>
      </div>
    </form>

    <div style="width: 30em; margin-top: 20px; text-align: center;">
      <a href="view_members.php?start=<?php echo $start ?>&amp;order=<?php echo $order ?>">Back</a>
    </div>

<?php
  displayPageFooter();
} ?>

这很好,但是我添加$lesuur = $member->getValueEncoded( 'lesuur' );的那一刻 代码我得到一个白色屏幕,任何人可以帮助我这个?现在整个上午都在寻找解决方案。

编辑:这是getvalueencoded代码

//waarde uit de array halen
  public function getValue( $field ) {
    if ( array_key_exists( $field, $this->data ) ) {
      return $this->data[$field];
    } else {
      die( "Field not found" );
    }
  }
//speciale karakters omzetten
  public function getValueEncoded( $field ) {
    return htmlspecialchars( $this->getValue( $field ) );
  }

0 个答案:

没有答案