-1

Hii, i am new here. I have an assignment and now i am confused so is here anyone who can helpp me. I have created the code lyk-

{<?php include 'header.php' ?>
<?php include 'connection.php'; ?>

<form name="f1" method="post" >
<b>COURSE:</b>
<select name="select" id="course">
<option value= "MCA" selected > MCA </option>
<option value= "MBA" > MBA </option>
<option value= "B.TECH"  > B.TECH</option>
</select>


<b>SEMESTER:</b>

  <select name="sem" >
  <option value="">select</option>

  <option value="1" >I</option>
 <option value="2" >II</option>
 <option value="3" >III</option>
 <option value="4" >IV</option>
 <option value="5" >V</option>
 <option value="6" >VI</option>
</select>
<input type="submit" value="Click Here!!"/> </br>
</form>
<?php
if(isset($_POST['sem']))
{
$ans=$_POST['sem'];

if($ans=="1")
{   
$result=mysql_query("select Name from subject_information where sub_code like 'CA- 1%'"); ?>
<form name="f2" method="post" action="">
Subject :<select name="sub" multiple="multiple">
<?php
while($row=mysql_fetch_array($result))
{

echo "<option value='".$row['Name']."'>".$row['Name']."</option>";
}
?>
</select>
<?php
}
elseif($ans=="2")
{   
$result=mysql_query("select Name from subject_information where sub_code like 'CA- 2%'"); ?>
<form name="f3" method="post" action="">
Subject :<select name="sub" multiple="multiple">
<?php
while($row=mysql_fetch_array($result))
{

echo "<option value='".$row['Name']."'>".$row['Name']."</option>";
}?>
</select>
<?php
}

elseif($ans=="3")
{   
$result=mysql_query("select Name from subject_information where sub_code like 'CA- 3%'"); ?>
<form name="f4" method="post" action="">
Subject :<select name="sub" multiple="multiple">
<?php
while($row=mysql_fetch_array($result))
{
echo "<option value='".$row['Name']."'>".$row['Name']."</option>";
}?>
</select>
<?php
}
elseif($ans=="4")
{   
$result=mysql_query("select Name from subject_information where sub_code like 'CA- 4%'"); ?>
<form name="f5" method="post" action="">
Subject :<select name="sub" multiple="multiple">
<?php
while($row=mysql_fetch_array($result))
{
echo "<option value='".$row['Name']."'>".$row['Name']."</option>";
}?>
</select>
<?php
}
elseif($ans=="5")
{   
$result=mysql_query("select Name from subject_information where sub_code like 'CA- 5%'"); ?>
<form name="f6" method="post" action="">
Subject :<select name="sub" multiple="multiple">
<?php
while($row=mysql_fetch_array($result))
{

echo "<option value='".$row['Name']."'>".$row['Name']."</option>";
}?>
</select>
<?php
}
elseif($ans=="6")
{   
$result=mysql_query("select Name from subject_information where sub_code like 'CA- 6%'"); ?>
<form name="f7" method="post" action="">
Subject :<select name="sub" multiple="multiple">
<?php
while($row=mysql_fetch_array($result))
{
echo "<option value='".$row['Name']."'>".$row['Name']."</option>";

}?>
</select>
<?php
}
}
?>
<br>
<br>
<br>
<form name="a1"   method="post" action="generate.php">
<input type="submit" value="GENERATE" style="font-size:18px;background-color:black;color:white" size="5" onClick="window.location.href='http://localhost/vishii/format.php' ">

</form>

  <?php include 'footer.php' ?>



-

Edited by JorgeM: Moved to PHP

Votes + Comments
confuse on what ?
3
Contributors
3
Replies
21
Views
3 Years
Discussion Span
Last Post by diafol
0

Hey there! What are you trying to do with your program? We can only help you if we know what you want to do.

1

This is extremely difficult to follow for a number of reasons:

1) No code indenting - this makes it almost impossible to follow
2) Mixing html and php - keep them separate

Also you're using deprecated mysql - please switch to mysqli or PDO. You may get more responses if you make it easier for contributors to help you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.