Can Anyone help me????
Posted: Thu Aug 11, 2005 1:56 pm
Hi, I’m working with a database in mysql-php but I,ve some problems. Please help me if possible.
The first problem:
There are two tables I’ve called Subjects and Thematics. For each subject I’ve inserted the thematics. I have to use the information stored in these tables in another form. The form is for the presence of the students in seminars. The form contains many elements some of them are Profile, Academic Year, Thematic, Subject ect. The problem is that when I select the subject in subject List menu how can I do that at the thematics List Menu appear only the thematics that belongs to that subject and not all the thematics of all subjects. Is this possible with php?
The second problem is:
Before I go to the forme of presence of the students I’ve another forme whose action is the form of the presence of the students. In this form there are three List menus, one for the Profile, another for the year of study (First Year, Second Year….Fifth year) and another for the type of the séance (Seminar,Lecture,Laboratory ect.)
After I click the submit button, the action is the forme of the presence. In this form I’ve displayed again the three List menus (Profile,Year of Study and Type of séance), because their values is important to save in the database but now they have only one opsion the opsion that has been selected in the previus form.The problem is that when I try to insert these values in database they are not inserted.
This script is in the form: presence of the students
This script is in the file whose action is the form presence of the students:
listprofiles(); is a function that lists all the profiles that are inserted in the table profiles.
At the script that insert the information in database:
And the query: (I’ve translated only the profile, the other field and variables are in Albanian-my language)
Listprofile.php:
Comment: listodrejtimet() equivalent with listprofile()
Drejtimet in Albania = profiles in English
Emer in albania =Name in english
How can I solve this problem?
And finally another big problem is:
After selecting the profile, the Year of study and the type of the séance and after clicking to the submit button, at the form that it will be open, will appear all the students that belong to that profile and that year of study. For each student is a checkbox, that represent the presence of the student when is checked…And again in the database is not inserted the ID_Student, it remains 0. Maybe I’m not very clear but if you have understood what I’m explaing please help me. It’s for my diploma….I’ve it in Septembre and things are not going very well. PHP isn’t very easy. Thanks Bora
feyd | you really really need to post php code in
The first problem:
There are two tables I’ve called Subjects and Thematics. For each subject I’ve inserted the thematics. I have to use the information stored in these tables in another form. The form is for the presence of the students in seminars. The form contains many elements some of them are Profile, Academic Year, Thematic, Subject ect. The problem is that when I select the subject in subject List menu how can I do that at the thematics List Menu appear only the thematics that belongs to that subject and not all the thematics of all subjects. Is this possible with php?
The second problem is:
Before I go to the forme of presence of the students I’ve another forme whose action is the form of the presence of the students. In this form there are three List menus, one for the Profile, another for the year of study (First Year, Second Year….Fifth year) and another for the type of the séance (Seminar,Lecture,Laboratory ect.)
After I click the submit button, the action is the forme of the presence. In this form I’ve displayed again the three List menus (Profile,Year of Study and Type of séance), because their values is important to save in the database but now they have only one opsion the opsion that has been selected in the previus form.The problem is that when I try to insert these values in database they are not inserted.
This script is in the form: presence of the students
Code: Select all
<select name="Profile"> <option value=<? echo "<strong><font size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\" text color= \"005680\"> $profile </strong> </font>" ?></option>
</select>This script is in the file whose action is the form presence of the students:
Code: Select all
<select name="Profile">
<option></option>
<? listprofiles(); ?>
</select>At the script that insert the information in database:
Code: Select all
if (isset($_POST["Profile"]) )
{ $Profile = $_POST["Profile"]; } else { $Profile= "";}Code: Select all
if($Profile != "" && $VitiShkollor != "" && $VitiAkad!="" && $Viti!="" && $Muaji!="" && $Dita!="" && $Pedagog!="" && $Lenda!="" && $Tema!= "" && $Seanca!="" && $Prezent!="" ) {
$query = "INSERT INTO frekuentimi (ID_Seance,ID_Pedagog, ID_Student, ID_Lenda,ID_Profile,ID_Tema,Tipi,Dita,Muaji,Viti,Prezent,Viti_Shkollor,Viti_Akademik,NotaProj,PranuarDet)
VALUES (NULL, '$Pedagog', '$ID_Student', '$Lenda', '$Profile', '$Tema','$Seanca','$Dita','$Muaji','$Viti','$Prezent','$VitiShkollor','$VitiAkad','$Nota','$Pranuar')";
if (mysql_query($query)) echo ("<p><font color=\"#00FF00\" size=\"3\" face=\"Arial, Helvetica, sans-serif\">Rrjeshti 1 u shtua në databazë...</font></p>"); else echo ("lesh");
} else if($Lenda == "") { $err1 = "<p><font color=\"#FF0000\" size=\"3\" face=\"Arial, Helvetica, sans-serif\"> <li>Plotësoni patjetër fushen Emër Departamenti në rrjeshtin 1</li></font></p>";
echo $err1;
}Comment: listodrejtimet() equivalent with listprofile()
Drejtimet in Albania = profiles in English
Emer in albania =Name in english
Code: Select all
<?
function listodrejtimet()
{
global $HTTP_POST_VARS;
/* Listohen grupet */
$query_drejtimet = "SELECT ID_Drejtimi, Emer, ID_Departament from drejtimet WHERE PrindID is NULL ORDER BY Emer";
$result_drejtimet = mysql_query($query_drejtimet) or die ("Error in query:$query_drejtimet. " . mysql_error());
while ($row_drejtimet = mysql_fetch_array($result_drejtimet)) {
if (isset ($HTTP_POST_VARS["PrindID"]) and $HTTP_POST_VARS['PrindID']==$row_drejtimet["ID_Drejtimi"])
{
?><option selected value="<? echo $row_drejtimet["ID_Drejtimi"]; ?>"><? echo $row_drejtimet["Emer"];?> </option>
<?
} else {
?> <option value="<? echo $row_drejtimet["ID_Drejtimi"]; ?>"> <? echo $row_drejtimet["Emer"];?></option>
<?
}
afisho2($row_drejtimet["Emer"], 1);
}
}//mbaron funksioni listogrupet()
function afisho2($PrindID, $niveli)
{
global $HTTP_POST_VARS;
$query_emer = "SELECT ID_Drejtimi, Emer from drejtimet WHERE PrindID='$PrindID' ORDER BY Emer";
$result_emer = mysql_query($query_emer) or die ("Error in query:$query_emerdrejtimi. " . mysql_error());
while ($row = mysql_fetch_array($result_emer)) {
if (isset ($HTTP_POST_VARS["PrindID"]) and $HTTP_POST_VARS['PrindID']==$row["ID_Drejtimi"])
{
?><option selected value="<? echo $row["ID_Drejtimi"]; ?>"><? echo $row["Emer"];?> </option>
<?
} else {
?> <option value="<? echo $row["ID_Drejtimi"]; ?>"> <? echo " " .$row["Emer"];?></option>
<?
}
afisho2($row["Emer"], 1);
}
}
//mbaron funksioni afisho()
?>And finally another big problem is:
After selecting the profile, the Year of study and the type of the séance and after clicking to the submit button, at the form that it will be open, will appear all the students that belong to that profile and that year of study. For each student is a checkbox, that represent the presence of the student when is checked…And again in the database is not inserted the ID_Student, it remains 0. Maybe I’m not very clear but if you have understood what I’m explaing please help me. It’s for my diploma….I’ve it in Septembre and things are not going very well. PHP isn’t very easy. Thanks Bora
feyd | you really really need to post php code in
Code: Select all
tags to help us help you.[/color]