Jump to content

Multiple dropdown boxes


waleed82

Recommended Posts

<?php

 

include("database.php");

 

class SendSms{

 

public function viewDeptName(){

$result=database::getdepartment();

$rows=mysql_num_rows($result);

 

echo("<center> <h3> Sms Sending </h3> </center>");

 

echo("<center><table border='2'>");

 

echo("<form action='http://localhost/smspctomobile/SendSms.php' method=post>");

 

echo("<tr> <td> Department: </td>");

echo("<td> <select name=deptId onchange='this.form.submit();'> ");

echo("<option> select department </option>");

 

$i=0;

while($i<$rows){

 

$id=mysql_result($result,$i,"dept_id");

$name=mysql_result($result,$i,"dept_name");

 

echo("<option value=$id>$name</option> ");

 

$i++;

}//end loop

 

echo("</select> </td> </tr>");

echo("</form>");

 

}//end department Name

 

public function viewProgram($deptId){

$result=database::getProgram($deptId);

 

$rows=mysql_num_rows($result);

 

echo("<form action='http://localhost/smspctomobile/SendSms.php' method=post>");

 

echo("<tr> <td> Program: </td>");

echo("<td> <select name='progId' onchange='this.form.submit();'>");

echo("<option> Select Program </option> ");

 

$i=0;

while($i<$rows){

 

$id=mysql_result($result,$i,"prog_id");

$name=mysql_result($result,$i,"prog_name");

 

echo("<option value=$id>$name</option>");

 

$i++;

}//end loop

echo("</select> </td> </tr>");

echo("</form>");

} // end viewProgram

 

public function viewBatch($progId){

$result=database::getBatch($progId);

 

$rows=mysql_num_rows($result);

 

echo("<form action='http://localhost/smspctomobile/SendSms.php' method=post>");

 

echo("<tr> <td> Batch: </td>");

echo("<td> <select name=batchId onchange='this.form.submit();'>");

echo("<option> Select Batch </option> ");

 

$i=0;

while($i<$rows){

 

$id=mysql_result($result,$i,"batch_id");

$name=mysql_result($result,$i,"batch_name");

 

echo("<option value=$id>$name</option>");

 

$i++;

}//end loop

echo("</select> </td> </tr>");

echo("</form>");

 

} // end viewBatch

 

public function viewBatchShift($batchId){

 

$result=database::getBatchNameAndShift($batchId);

 

$rows=mysql_num_rows($result);

 

echo("<form action='http://localhost/smspctomobile/SendSms.php' method=post>");

 

echo("<tr> <td> Batch Shift: </td>");

echo("<td> <select name=batchId2 onchange='this.form.submit();'>");

echo("<option>Select Shift</option> ");

 

$id=mysql_result($result,0,"batch_id");

$shift=mysql_result($result,0,"batch_shift");

 

echo("<option value=$id>$shift</option>");

 

echo("</select> </td> </tr>");

echo("</form>");

 

} // end viewBatchShift

 

public function selection($batchId2){

 

echo("<tr> <td> Select Procedure: </td>");

 

echo("<form action='http://localhost/smspctomobile/SendSms.php' method=post>");

echo("<td> <select name='selc' onchange='this.form.submit();'>");

echo("<option >Select</option> ");

echo("<option value='multi'> Multiple </option>");

echo("<option value='all'> Send To All </option>");

echo("</select></td></tr>");

echo("<input type='hidden' name='batchId3' value='$batchId2'>");

echo("</form>");

 

} // end method selection

 

public function viewStudentNum($batchId3){

echo($batchId3."<br>");

 

echo("<form action='http://localhost/smspctomobile/sms.php' method=post>");

 

echo("<tr> <td> Write Sms: </td> <td> <textarea rows='5' cols='35' name='message'>");

echo("</textarea> </td> </tr>");

echo("</table> <br>");

echo("<input type='submit' value='Send'>");

echo("</form");

echo("</center>");

 

} // end viewStudentNum

 

public function sendMsg($batchId3){

echo($batchId3."<br>");

 

$result=database::getStudents();

$rows=mysql_num_rows($result);

 

echo("<form action='http://localhost/smspctomobile/checkboxSMS.php' method=post>");

 

echo("<tr rowspan='4'> <td> Student Number: </td> <td colspan='2'>");

 

$i=0;

while($i<$rows){

$id=mysql_result($result,$i,"std_id");

$number=mysql_result($result,$i,"std_number");

$roll=mysql_result($result,$i,"std_rollNum");

 

echo("<input type='checkbox' name='numbers[]' value=$id>$roll<br/>");

$i++;

} // end loop

echo("</td> <input type='text' name='message'>");

echo("<input type='submit' name='submit' value='Submit'/>");

echo("</form>");

 

} // sendMsg Multiple

 

 

}//end class SendSms

 

 

$ob=new SendSms();

$ob->viewDeptName();

 

$deptId=$_POST['deptId'];

$ob->viewProgram($deptId);

 

$progId=$_POST['progId'];

$ob->viewBatch($progId);

 

$batchId=$_POST['batchId'];

$ob->viewBatchShift($batchId);

 

$batchId2=$_POST['batchId2'];

 

$ob->selection($batchId2);

 

$selc=$_POST['selc'];

 

if($selc=="multi"){

echo("<br> MULTI");

$batchId3=$_POST['batchId3'];

$ob->sendMsg($batchId3);

}

else if($selc=="all"){

echo("<br> ALL");

$batchId3=$_POST['batchId3'];

$ob->viewStudentNum($batchId3);

}

?>

Stop creating threads for your question. Since it's possible that you started this thread before you were issued the warning about hijacking the previous thread and you didn't see the warning, I won't issue a second warning for double-posting.

 

This thread will be merged with your existing thread for this question...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.