What's new
  • Welcome to PHCorner forums. Take a moment to sign up and gain unlimited access and extra privileges that guests are not entitled to, such as: All that and more! Registration is quick, simple and absolutely free. Join our community today!

Help Php programming pa help naman mga bossing.

Joined
Sep 12, 2016
Messages
337
Reaction
70
Good day mga bossing patulong naman. Sino po yung may alam regarding sa PHP coding.. ito po yung code ko..

this is my code:

<div id="Restarter" class="colors6" style="display:none">
<label>Previous Method <font color = "red" size = "1"> <i>Required</i></font></label>
<?php $fplist = mysql_query("SELECT * from listoffpmethod"); ?>
<select id = "unmet_prevmethod1" class="form-control" >
<option value = "">Please select</option>
<?php while($rowlist = mysql_fetch_row($fplist)) { ?>
<option value = "<?php echo $rowlist[1]; ?>"><?php echo $rowlist[1]; ?></option>
<?php } ?>
</select>
</div>

table name: listoffpmethod

Id - Description - Gender
1 - ***** - Female
2 - CIC - Female
3 - DMPA - Female
4 - IUD - Female
5 - ****** - Male
6 - Vasectomy - Male

output :

1.png

ang gusto ko sana kung yung gender ay male dapat ****** ang vasectomy lang ang lalabas .. din kung ang gender niya ay female dapat *****, cic and etc ang lalabas..

I hope matulong niyo sana ako mga bossing...
 

Attachments

ito po yung buong codes:

<div class="modal fade" id="addFPServices_form" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Family Planning Services(Unmet Needs)</h4>
</div>
<div class="modal-body">
<div class="col-xs-12">
<div class="form-group">
<input type ="hidden" id ="fp_memberID">

<!-------------------------------------------------------->
<label>Date Interviewed <font color = "red" size = "1"> <i>Required</i></font></label>
<input type="date" class="form-control" id = "unmet_inaterviewed" />
<label>Category <font color = "red" size = "1"> <i>Required</i></font></label>
<select id = "unmet_fpstatus" class="form-control" >
<option value = "">Please select</option>
<option value = "New">Unmet</option>
<option value = "Restarter">Restarter</option>
<option value = "Changing">Changing Method</option>
</select>

<div id="Restarter" class="colors6" style="display:none">
<label>Previous Method <font color = "red" size = "1"> <i>Required</i></font></label>
<?php $fplist = mysql_query("SELECT * from listoffpmethod"); ?>
<select id = "unmet_prevmethod1" class="form-control" >
<option value = "">Please select</option>
<?php while($rowlist = mysql_fetch_row($fplist)) { ?>
<option value = "<?php echo $rowlist[1]; ?>"><?php echo $rowlist[1]; ?></option>
<?php } ?>
</select>
</div>

<div id="Changing" class="colors6" style="display:none">
<label>Previous Method <font color = "red" size = "1"> <i>Required</i></font></label>
<?php $fplist = mysql_query("SELECT * from listoffpmethod") ?>
<select id = "unmet_prevmethod1a" class="form-control" >
<option value = "">Please select</option>
<?php while($rowlist = mysql_fetch_row($fplist)) { ?>
<option value = "<?php echo $rowlist[1]; ?>"><?php echo $rowlist[1]; ?></option>
<?php } ?>
</select>
</div>


<label>Preferred Method <font color = "red" size = "1"> <i>Required</i></font></label>
<?php $fplist = mysql_query("SELECT * from listoffpmethod") ?>
<select id = "unmet_preferredmethod" class="form-control" >
<option value = "">Please select</option>
<?php while($rowlist = mysql_fetch_row($fplist)) { ?>
<option value = "<?php echo $rowlist[1]; ?>"><?php echo $rowlist[1]; ?></option>
<?php } ?>
</select>

<label>Reason for Wanting FP <font color = "red" size = "1"> <i>Required</i></font></label>
<select id = "unmet_reason" class="form-control" >
<option value = "">Please select</option>
<option value = "Limiting">Limiting</option>
<option value = "Spacing">Spacing</option>
</select>

<!-------------------------------------------------------->
</div>
</div>
</div>

<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="checkFPunmet()">Save</button>
</div>
</div>
</div>
</div>
 
Comment
ganito gawinmo gawa ka ng condition na mag fifilter ng data, mag sasala, ibig ko sabihin gawa ka ng condition na mag checheck kung male at female sya sa loob ng looping mo, sa loob ng while{ }. para lahat ng data na ilalabas nya ay ma checeheck kung male or female. parang ganito. lagay mo dapat yung if statement mo sa loob ng while loop mo. Example If(gender == "male"){
echo "male"}
elseif(gender == "female"){
echo "female"
}else{

do whatever you want here

};

tapos gamit ka na ng latest na mysqli, luma kasi gamit mo. mag upgrade ka na sa PHP 7.
 
Comment

Jmrie_

ᜑ᜔ᜋ᜔ᜇ̵̊ᜁ
Contributor
ganito gawinmo gawa ka ng condition na mag fifilter ng data, mag sasala, ibig ko sabihin gawa ka ng condition na mag checheck kung male at female sya sa loob ng looping mo, sa loob ng while{ }. para lahat ng data na ilalabas nya ay ma checeheck kung male or female. parang ganito. lagay mo dapat yung if statement mo sa loob ng while loop mo. Example If(gender == "male"){
echo "male"}
elseif(gender == "female"){
echo "female"
}else{

do whatever you want here

};

tapos gamit ka na ng latest na mysqli, luma kasi gamit mo. mag upgrade ka na sa PHP 7.
pwede ba mag tanung sayo about sa programmng
 
Comment
Gamit ka conditional statement and filter then magfocus ka sa gender kc sya ung tatawagin mo. For example: <?php
$fplist = mysql_query("SELECT * from listoffpmethod");
$gender=$row['gender'];
If ($gender=="male" ) {
$query= mysql_query("SELECT * from listoffpmethod WHERE gender='male'");
} else {
$query= mysql_query("SELECT * from listoffpmethod WHERE gender='female'");
}

$row=mysqli_fetch_assoc($query);

while ($result=mysqli_num_rows($row) {
echo $row['items'];
} else {
eho 'failed';
}
?>


Try mo. Feedback kung ano mali
 
Comment

Online statistics

Members online
1,765
Guests online
1,830
Total visitors
3,595

Forum statistics

Threads
1,071,251
Messages
18,111,899
Members
1,515,865
Comments
1,079,581
Attachments
1,386,958
Profile posts
97,576
Top