2012-04-29 13 views
-1

私はurlを使用してフォームなしで変数を渡すことに関する情報を見つけようとしていましたが、私の状況に関係するanythigを見つけることはできません。 基本的には、リストから1つのコースをクリックしてセクションのリストを表示できるという意味で階層的なページを持つ必要があります。セクションをクリックすると、正しいページが表示されますその1つのセクションの情報私はこの状況のた​​めに$ _SESSIONを使用して、変数をURLに含めるよう教えられました。私の問題は、コースやセクションをクリックするたびに、1つのコースまたはセクションの情報だけでなく、クエリの一致であるすべてのコースまたはセクションの情報が表示されることです。これは、階層的な順序でページのそれぞれに対して持っているものです(とにかくうまく動作するコードの接続部分は含まれません)。私はこれが大量のコードであり、完全な混乱であることを知っています。私は情報を探し続けています。そして、何か助けを求める前に多くの多くの感謝をします。セクションのURLを使用してフォームなしで変数を渡す

session_start(); 
$section = $_SESSION['section_id']; 
$user_fname = $_SESSION['user_fname']; 
$user_lname = $_SESSION['user_lname']; 





    $query = "SELECT DISTINCT course_t.course_id, course_name, user_fname, user_lname, section_t.section_id 
       FROM course_t, authorized_user_t, section_t, teaching_history_t 
       WHERE authorized_user_t.authorized_user_id = teaching_history_t.instructor_id 
       AND teaching_history_t.section_id = section_t.section_id 
       AND section_t.course_id = course_t.course_id"; 





$result = @mysql_query($query); 



while ($line1 = mysql_fetch_array($result, MYSQL_ASSOC)) { 


    echo '<p align = "center"><strong><a href ="section_list.php?section_id='.$line1['section_id'].'&user_fname='.$line1['user_fname'].'&user_lname='.$line1['user_lname'].'">' .$line1['course_id'].':'.$line1['course_name']. '</a></strong><br><br>'; 




    } 

リスト(彼らが自分の名前の下に教えるセクションのそれぞれを単一intructorをリストするはずとされる)

session_start(); 

$section_id = $_REQUEST['section_id']; 
$user_fname = $_REQUEST['user_fname']; 
$user_lname = $_REQUEST['user_lname']; 


$course_id = $_SESSION['course_id']; 
$course_name = $_SESSION['course_name']; 
$section_id = $_SESSION['section_id']; 
$semester = $_SESSION['semester']; 
$year = $_SESSION['year']; 
$course_description = $_SESSION['course_description']; 
$SGoal_Description = $_SESSION['SGoal_Description']; 
$sobjective_description = $_SESSION['sobjective_description']; 
$LObjective_Description = $_SESSION['LObjective_Description']; 
$topic_title = $_SESSION['topic_title']; 
$topic_description = $_SESSION['topic_description']; 
$coursework_title = $_SESSION['coursework_title']; 
$coursework_location = $_SESSION['coursework_location']; 
$coursework_description = $_SESSION['coursework_description']; 



    $query = "SELECT course_t.course_id, course_name, section_t.section_id, semester, year, course_description, 
        SGoal_Description, sobjective_description, LObjective_Description, topic_title, topic_description, coursework_title, 
        coursework_location, coursework_description, syllabus 
       FROM course_t, section_t, section_goal_section_t, section_goal_t, section_coursework_t, 
       mapped_topic_section_t, mapped_lis_section_t, coursework_t, topic_t, lis_objective_t, section_objective_t 
       WHERE course_t.course_id = section_t.course_id 
       AND section_t.section_id = section_goal_section_t.section_id 
       AND section_goal_section_t.sgoal_id = section_goal_t.sgoal_id 
       AND section_goal_section_t.section_id = mapped_lis_section_t.section_id 
       AND mapped_lis_section_t.lobjective_id = lis_objective_t.lobjective_id 
       AND section_t.section_id = mapped_topic_section_t.section_id 
       AND mapped_topic_section_t.topic_id = topic_t.topic_id 
       AND section_t.section_id = section_coursework_t.section_id 
       AND mapped_lis_section_t.sobjective_id = section_objective_t.sobjective_id 
       AND section_coursework_t.coursework_id = coursework_t.coursework_id"; 


    $result = @mysql_query($query); 

     while ($line1 = mysql_fetch_array($result, MYSQL_ASSOC)) { 


    echo '<ul align = "center"<strong>' .'Instructor'. ':' ."$user_fname". "$user_lname".'<li align = "center"> 
    <a href ="course_section.php?course_id='.$line1['course_id'].'&course_name='.$line1['course_name'].'&section_id='.$line1['section_id'].' 
    &semester='.$line1['semester'].'&year='.$line1['year'].'&course_description='.$line1['course_description'].' 
    &SGoal_Description='.$line1['SGoal_Description'].'&sobjective_description='.$line1['sobjective_description'].' 
    &LObjective_Description='.$line1['LObjective_Description'].'&topic_title='.$line1['topic_title'].' 
    &topic_description='.$line1['topic_description'].'&coursework_title='.$line1['coursework_title'].' 
    &coursework_location='.$line1['coursework_location'].'&coursework_description='.$line1['coursework_description'].'">'.$line1['section_id'].'</a></strong><br><br>'; 


    } 

セクション情報コースの

一覧(表示されるはずですクリックされたセクションの情報)

session_start(); 

     $topic_description = $SESSION['topic_description']; 
     $coursework_description = $SESSION['coursework_description']; 

     $course_id = $_REQUEST['course_id']; 
     $course_name = $_REQUEST['course_name']; 
     $section_id = $_REQUEST['section_id']; 
     $semester = $_REQUEST['semester']; 
     $year = $_REQUEST['year']; 
     $course_description = $_REQUEST['course_description']; 
     $SGoal_Description = $_REQUEST['SGoal_Description']; 
     $sobjective_description = $_REQUEST['sobjective_description']; 
     $LObjective_Description = $_REQUEST['LObjective_Description']; 
     $topic_title = $_REQUEST['topic_title']; 
     $topic_description = $_REQUEST['topic_description']; 
     $coursework_title = $_REQUEST['coursework_title']; 
     $coursework_location = $_REQUEST['coursework_location']; 
     $coursework_description = $_REQUEST['coursework_description']; 



    echo '<div align = "right">'; 

    echo '<a href="section_list.php">Return to List of Sections</a>'; 

     echo '</div>'; 


    $query = "SELECT DISTINCT course_t.course_id, course_name, section_t.section_id, semester, year, course_description, 
        SGoal_Description, sobjective_description, LObjective_Description, topic_title, topic_description, coursework_title, 
        coursework_location, coursework_description, syllabus 
       FROM course_t, section_t, section_goal_section_t, section_goal_t, section_coursework_t, 
       mapped_topic_section_t, mapped_lis_section_t, coursework_t, topic_t, lis_objective_t, section_objective_t 
       WHERE course_t.course_id = section_t.course_id 
       AND section_t.section_id = section_goal_section_t.section_id 
       AND section_goal_section_t.sgoal_id = section_goal_t.sgoal_id 
       AND section_goal_section_t.section_id = mapped_lis_section_t.section_id 
       AND mapped_lis_section_t.lobjective_id = lis_objective_t.lobjective_id 
       AND section_t.section_id = mapped_topic_section_t.section_id 
       AND mapped_topic_section_t.topic_id = topic_t.topic_id 
       AND section_t.section_id = section_coursework_t.section_id 
       AND mapped_lis_section_t.sobjective_id = section_objective_t.sobjective_id 
       AND section_coursework_t.coursework_id = coursework_t.coursework_id"; 

     $result = @mysql_query($query); 


    while ($line1 = mysql_fetch_array($result, MYSQL_ASSOC)) { 


     echo '<p align = "center"><strong>' .$line1['course_id'].':'.' '.$line1['course_name']. '</strong><br><br>'; 

     echo '<p align = "center"><strong>' .$line1['section_id'].':'.' '.$line1['semester'].'/'.$line1['year']. '</strong><br><br>'; 

     echo '<p align = "left"><strong>' .$line1['course_description'].'</strong><br><br><br><br>'; 




    echo '<div align = "left">';   

     echo '<ul align = "left"><strong>Section Goals:</strong></ul><li align = "left">' .$line1['SGoal_Description']. '</li>'; 

     echo '<ul align = "left"><strong>Section Objectives:</strong></ul><li align = "left">' .$line1['sobjective_description']. '</li>'; 

     echo '<ul align = "left"><strong>Mapped Objectives:</strong></ul><li align = "left">' .$line1['LObjective_Description']. '</li>'; 

     echo '<ul align = "left"><strong>'.'Topic'.':'.' '.$line1['topic_title']. '</strong></ul> 
     <li align = "left"><a href = "topic_description.php?topic_description= '.$line1['topic_description'].'"target="_blank">Click for Topic Description</a>'; 

     echo '<ul align = "left"><strong>'.'Coursework'.':'.' '.$line1['coursework_title']. '</strong></ul> 
     <li align = "left"><a href = "coursework_description.php?coursework_description= '.$line1['coursework_description'].'"target="_blank">Click for Coursework Description</a>'; 




    } 
+0

私はセッションの必要性を見ていないだけでURLにvarを渡す –

+0

あなたのコードは乱雑です。本当に乱雑です。 –

+0

@ダゴンそれは彼がそれを知っていない彼の問題です。 –

答えて

0

エッセンスを作成するには、url example:example.com/index.php?example=trueに含めるだけです。 $ _GET ['example']を使用すると、値は'true'になります。

+0

セッションをまったく使用しないでください。それらを$ _GETで置き換えますか? – user1350252

+1

正しいですが、それぞれのページで同じ変数を使用していることを確認してください。例:index.phpにリダイレクトするには 'header(" location:index.php? "。$ _SERVER ['query_string'])'これで同じすべてのリダイレクトページのクエリ文字列。リンクの場合も同様にしてください(例:Link ' –

関連する問題