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);

}

?>

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.