how can it be done?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rami
Forum Contributor
Posts: 217
Joined: Thu Sep 15, 2005 8:55 am

how can it be done?

Post by rami »

Code: Select all

<?
....

$sm= ($_POST['semester']);
...


	
	if ($g1 && $g2 && $g3 && $g4 && $g5 ) 
		{ 
if ($sm==1)
{	
	$query = "insert into  

result(user_id,purpose,subone,gone,subtwo,gtwo,subthree,gthree,subfour,gfour,s  ubfive,gfive,grand,

remarks,semester) VALUES ('$p1','$p','Enlish I','$g1','Business Mathematics I','$g2','Financial 

Accounting I','$g3','Principle of Management','$g4','Computer 

Application','$g5','$sg','$rm','$sm')";
}	
elseif ($sm==2)
{
$query = "insert into  

result(user_id,purpose,subone,gone,subtwo,gtwo,subthree,gthree,subfour,gfour,s  ubfive,gfive,grand,

remarks,semester) VALUES ('$p1','$p','English II','$g1','Business Mathematics 

II','$g2','Financial Accounting II','$g3','Mircoeconomics','$g4','Programming 

Language','$g5','$sg','$rm','$sm')";
}
elseif ($sm==3)


?>
//the html part
<tr>
            <td width="41%"><b>Select Semester </b></td>
            <td width="59%"><select name="semester"><option value="NULL" >select one</option>
<option value="1" >First</option>
<option value="2" >Second</option>
<option value="3" >Third</option>
<option value="4" >fourth</option>
<option value="5" >fifth</option>
<option value="6" >sixth</option>
<option value="7" >Seventh</option>
<option value="8" >Eighth</option>
</select></td>
          </tr>	
<tr>
            <td width="41%"><b>Grade In first Subject </b></td>
            <td width="59%"><input type="text" name="grade1" size="8" maxlength="8" value="<?php 

if (isset($_POST['grade1'])) echo $_POST['grade1']; ?>" /></td>
          </tr>
<tr>
            <td width="41%"><b>Grade In second Subject </b></td>
            <td width="59%"><input type="text" name="grade2" size="8" maxlength="8" value="<?php 

if (isset($_POST['grade2'])) echo $_POST['grade2']; ?>" /></td>
          </tr>
The disadvantage of this method is that the dataentry operator should know all the subject

sequence in advance ...for eg if its 1st semester then ..the entry operator should know s/he

should enter Emglish I...then Business mathmetics ...and so on

(the form will display only enter "Grade in first subject ..second subject and so on...)

it is very problematic...
Cannot i display name of subject as semester is choosen in that drop down menu...?
for eg if 1st sem is choosen in dropdown then
name of subject appears in form..if 2nd choosen other 5 appears in form(rather than first,second

..subject)

how can i achieve that ...?
any help
It would be great if i could put drop down also in same form.
Post Reply