dannyone Posted February 23, 2009 Share Posted February 23, 2009 hello everyone, i have this select statement that displays all the students that the logged in marker is marking(Student_Markers table). now when a mark clicks on a student in the list i want it to display that students details from a seperate (Students) table where Students.Student_ID = Student_Markers.Student_ID). i think i would need to use a if else statement, but i don't understand how to do it. could some1 please help? i need another query to do; if $nt = Student.Student_ID then display FName, LName etc... heres what i have done so far... $query="SELECT Student,FName,LName FROM Student_Markers,Student WHERE Student_Markers.Student = Student.Student_ID AND Marker1 = '" .$_SESSION['login'] . "'"; $result = mysql_query ($query); echo "<select Student=Student value=''>Student</option>"; while($nt=mysql_fetch_array($result)){ echo "<option value=$nt[student]>$nt[student], $nt[FName], $nt[LName]</option>"; } echo "</select>"; any help would be great thanks Link to comment https://forums.phpfreaks.com/topic/146505-select-if-statement-help/ Share on other sites More sharing options...
wrathican Posted February 23, 2009 Share Posted February 23, 2009 have a page called display_students.php (or similar) and use POST in your form to send the value of the select. the value of the select should be the id of the selected student in the table. your page would then be something like: <?php $id = $_POST['student']; //query $query = "SELECT * FROM students WHERE id='$id' LIMIT 1"; //display your data ?> Link to comment https://forums.phpfreaks.com/topic/146505-select-if-statement-help/#findComment-769142 Share on other sites More sharing options...
dannyone Posted February 23, 2009 Author Share Posted February 23, 2009 thanks for the reply wrathican, your idea of posting the value is something i wouldnt of thought of an sounds like the best option to do, but how can i do this? im not very good with php sorry Thanks Link to comment https://forums.phpfreaks.com/topic/146505-select-if-statement-help/#findComment-769164 Share on other sites More sharing options...
revraz Posted February 23, 2009 Share Posted February 23, 2009 Google Forms and PHP. Link to comment https://forums.phpfreaks.com/topic/146505-select-if-statement-help/#findComment-769171 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.