what happen to my code the display the scenario goes like this call to undefine function mysql_prep???please help me!!!!!thnx a lot good bless

<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php find_selected_page(); ?>

<?php
     if (intval($_GET['subj']) == 0) {
        redirect_to("content.php");
     }
     if (isset($_POST['submit'])){
        $errors = array();

        $required_fields=array('menu_name', 'position', 'visible');
        foreach($required_fields as $fieldname) {
            if (!isset($_POST[$fieldname]) || (empty($_POST[$fieldname]) &&
            $_POST[$fieldname] !=0)) {
               $errors[] = $fieldname;
            }
     }
     $fields_with_lengths = array('menu_name' => 40);
     foreach($fields_with_lengths as $fieldname => $maxlength ) {
     // (error this area)    if (strlen(trim(mysql_prep)($_POST[$fieldname]))) > $maxlength) { //
          $errors[] = $fieldname; }
     }

     if (empty($errors)){
     //Perform Update
       $id = mysql_prep($_GET['subj']);
       $menu_name = mysql_prep($_POST['menu_name']);
       $position = mysql_prep($_POST['position']);
       $visible = mysql_prep($_POST['visible']);

       $query = "UPDATE subjects SET
                menu_name = '{$menu_name}',
                position = {$position},
                visible = {$visible}
            WHERE id = {$id}";
            $result = mysql_query($query, $connection);
            if (mysql_affected_rows() == 1){
               // Succcess
            }else{
               // Failed
            }

       } else{
         // Errors Occured
         }

  } // End: if (isset($_POST['submit']))
?>
<?php find_selected_page(); ?>
<?php include("includes/header.php"); ?>
<table id="structure">
    <tr>
        <td id="navigation">
        <?php echo navigation($sel_subject, $sel_page); ?>
        </td>
        <td id="page">
            <h2> Edit Subject: <?php echo $sel_subject['menu_name']; ?></h2>
            <form action="edit_subject.php?subj=<?php echo
            urlencode($sel_subject['id']); ?>" method="post">
            <p>Subject name:
            <input type="text" name="menu_name" value="<?php echo $sel_subject['menu_name']; ?>" id="menu_name" />
                  </p>
                  <p>Position:
                      <select name="position">
                              <?php
                                   $subject_set = get_all_subjects();
                                   $subject_count = mysql_num_rows($subject_set);
                                   // $subject_count + 1 Because we are adding a subject
                                   for($count=1; $count <= $subject_count+1; $count++) {
                                       echo "<option value=\"{$count}\"";
                                       if ($sel_subject['position'] == $count) {
                                          echo " selected";
                                       }
                                       echo ">{$count}</option>";
                                   }
                              ?>
                      </select>
                  </p>
                  <p>Visible:
                      <input type="radio" name="visible" value="0"<?php
                      if ($sel_subject['visible'] == 0) {echo " checked"; }
                      ?> /> No
                      &nbsp;
                      <input type="radio" name="visible" value="1"<?php
                      if ($sel_subject['visible'] == 1) { echo" cheked";}
                      ?> /> Yes
                  </p>
                      <input type="submit" name="submit" value="Edit Subject" />
                      <a href=\"delete_subject.php\">Delete Subject</a>
            </form>
            <br />
            <a href="content.php">Cancel</a>
        </td>
    </tr>
</table>
<?php require("includes/footer.php"); ?>

// (error this area) if (strlen(trim(mysql_prep)($_POST[$fieldname]))) > $maxlength)

from what you have said, it seems you are calling the function mysql_prep...
Every function call has to follow the format as

function_name(parameters);

in the line where you have showed error, you have written mysql_prep)(...
It might just be a typo, but it should be

if (strlen(trim(mysql_prep($_POST[$fieldname]))) > $maxlength)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.