Multiple dropdown boxes
Started by waleed82, Feb 03 2013 09:37 AM
9 replies to this topic
#1
Posted 03 February 2013 - 09:37 AM
Sir I m facing problem in Multiple Select Options using Ajax plz help me out ..
I m posting code plz help me
I m posting code plz help me
#2
Posted 03 February 2013 - 09:38 AM
<?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/sms...ile/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/sms...ile/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/sms...ile/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/sms...ile/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/sms...ile/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/sms...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);
}
?>
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/sms...ile/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/sms...ile/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/sms...ile/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/sms...ile/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/sms...ile/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/sms...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);
}
?>
#3
Posted 03 February 2013 - 09:39 AM
Here iz the code wher i want to use Ajax in these Select Options so that page will not load
#4
Posted 03 February 2013 - 10:09 AM
Im Uploading a file in this i want to use Ajax in Select Option so that on every selection page will not load.. plz help me out
Attached Files
#5
Posted 03 February 2013 - 10:24 AM
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...
This thread will be merged with your existing thread for this question...
Signature: (not a comment about anything you posted unless specifically indicated)
Debugging step #1: To get past the garbage-out equals garbage-in stage in your code, you must check that the inputs to your code are what you expect.
Programming is just problem solving, but it is done in another language. You must learn enough of the programming language you are using to be able to read and write code.
Debugging step #1: To get past the garbage-out equals garbage-in stage in your code, you must check that the inputs to your code are what you expect.
Programming is just problem solving, but it is done in another language. You must learn enough of the programming language you are using to be able to read and write code.
#6
Posted 03 February 2013 - 10:35 AM
SO WHAT IS THE WAY TO ASK Question ????
#7
Posted 03 February 2013 - 10:38 AM
SO WHAT IS THE WAY TO ASK Question ????
Edited by waleed82, 03 February 2013 - 10:38 AM.
#8
Posted 03 February 2013 - 10:38 AM
You need to explain:
- What *exactly* you want to happen
- What *does* happen
- What you have done to troubleshoot it.
And only post the RELEVANT code, using code tags.
- What *exactly* you want to happen
- What *does* happen
- What you have done to troubleshoot it.
And only post the RELEVANT code, using code tags.
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
#9
Posted 03 February 2013 - 10:52 AM
i want to do that is ..
when i select Department dan in other Select Tag programs Open after that select Any One Program another Select Tag Batch open.. & so 0n
when i select Department dan in other Select Tag programs Open after that select Any One Program another Select Tag Batch open.. & so 0n
#10
Posted 03 February 2013 - 02:49 PM
Anyy 0ne plz help me out :'(
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












