コード例 #1
0
    <?php 
$errors = session_errors();
?>
    <?php 
echo form_errors($errors);
?>
      <h2>Create Subject</h2>

    <form action="create_subject.php" method="post">
      <p>Menu name:
        <input type="text" name="menu_name" value="" />
      </p>
      <p>Position:
        <select name="position">
          <?php 
$subject_set = find_subjects();
$subject_count = mysqli_num_rows($subject_set);
// for counting the rows in the table
for ($count = 1; $count <= $subject_count + 1; $count++) {
    echo "<option value =\"{$count}\">{$count}</option>";
}
?>
        
        </select>
      </p>
      <p>Visible:
        <input type="radio" name="visible" value="0" /> No
        &nbsp;
        <input type="radio" name="visible" value="1" /> Yes
      </p>
      <input type="submit" name="submit" value="Create Subject" />
コード例 #2
0
ファイル: functions.php プロジェクト: vpandichi/wcorp
function public_navigation($subject_array, $page_array)
{
    $output = "<ul class=\"subjects\">";
    $subject_set = find_subjects();
    while ($subject = mysqli_fetch_assoc($subject_set)) {
        // output data from each row through the while loop
        $output .= "<li";
        if ($subject_array && $subject["id"] === $subject_array["id"]) {
            $output .= " class=\"selected\"";
        }
        $output .= ">";
        $output .= "<a href=\"index.php?subject=";
        $output .= urlencode($subject["id"]);
        $output .= "\">";
        $output .= htmlentities($subject["menu_name"]);
        $output .= "</a>";
        if ($subject_array["id"] == $subject["id"] || $page_array["subject_id"] == $subject["id"]) {
            $page_set = find_pages_for_subject($subject["id"]);
            $output .= "<ul class=\"pages\">";
            while ($page = mysqli_fetch_assoc($page_set)) {
                $output .= "<li";
                if ($page_array && $page["id"] === $page_array["id"]) {
                    $output .= " class=\"selected\"";
                }
                $output .= ">";
                $output .= "<a href=\"index.php?page=";
                $output .= urlencode($page["id"]);
                $output .= "\">";
                $output .= htmlentities($page["menu_name"]);
                $output .= "</a>";
                $output .= "</li>";
            }
            $output .= "</ul>";
            mysqli_free_result($page_set);
        }
        $output .= "</li>";
    }
    mysqli_free_result($subject_set);
    $output .= "</ul>";
    return $output;
}
コード例 #3
0
function public_navigation($subject_array, $page_array)
{
    // for public area
    // breaking the html to php
    // we can use the global in case of selected_subject_id= now subject_id and viz page_id
    $output = "<ul class =\"subjects\">";
    # for rendering the words
    $result_subject = find_subjects();
    // Use data
    // $subject & $subjects are differnt
    while ($subjects = mysqli_fetch_assoc($result_subject)) {
        # escaping the double quotes from mis understnd
        // echo "<li class =\"selected\" >"; breaking this to include if loop
        $output .= "<li";
        if ($subject_array && $subjects["id"] == $subject_array["id"]) {
            // checking the value is null and id is equal or not
            $output .= " class =\"selected\"";
            #space is needed in front
        }
        $output .= ">";
        // ?subject= is  the GET variable to use
        $output .= "<a href=\"index.php?subject=";
        $output .= urlencode($subjects["id"]);
        $output .= "\">";
        $output .= htmlentities($subjects["menu_name"]);
        $output .= "</a>";
        if ($subject_array["id"] == $subjects["id"] || $page_array["subject_id"] == $subjects["id"]) {
            $result_page = find_pages($subjects["id"]);
            $output .= "<ul class =\"pages\">";
            // Use page data
            while ($page = mysqli_fetch_assoc($result_page)) {
                $output .= "<li";
                if ($page_array && $page["id"] == $page_array["id"]) {
                    // checking the value is null and id is equal or not
                    $output .= " class =\"selected\"";
                }
                $output .= ">";
                $output .= "<a href=\"index.php?page=";
                $output .= urlencode($page["id"]);
                $output .= "\">";
                $output .= htmlentities($page["menu_name"]);
                $output .= "</a>";
                // placing the links
                $output .= "</li>";
            }
            // Release the page data
            mysqli_free_result($result_page);
            $output .= "</ul>";
        }
        $output .= "</li>";
        // end of subject li
        // closing the while loop here
    }
    // Release the subject data
    mysqli_free_result($result_subject);
    $output .= "</ul>";
    return $output;
}
コード例 #4
0
</h2>

    <form action="edit_subject.php?subject=<?php 
echo urlencode($current_subject["id"]);
?>
"  method="post">
      <p>Menu name:
        <input type="text" name="menu_name" value="<?php 
echo htmlentities($current_subject["menu_name"]);
?>
" />
      </p>
      <p>Position:
        <select name="position">
          <?php 
$subject_set = find_subjects(false);
$subject_count = mysqli_num_rows($subject_set);
// for counting the rows in the table
for ($count = 1; $count <= $subject_count; $count++) {
    echo "<option value =\"{$count}\"";
    if ($current_subject["position"] == $count) {
        echo "Selected";
    }
    echo ">{$count}</option>";
}
//  $prev=swap_current($current_subject["position"]);
?>
        
        </select>
      </p>
      <p>Visible: