Jump to content

codeigniter foreach loops duplicates


GD77

Recommended Posts

Hello:
 

I m having this foreach duplicated in returned data this happened when I upgraded to a news version of xammp and can t figure out why the duplicated are taking place...

 

<?php
if(isset($sess_uLOG) && $sess_uLOG==true) {
$attrib = array('name'=>'fxxx','class' => 'fxxx');
echo form_open('main/profile',$attrib);
?>
<ul class="cont_up"><!-- START section Overview-->
<?php
foreach ($u_profile as $u_pr) : ?>
	<li>
		<div class="sec_topic">Overview<span><?php $ubtn=array('name'=>'form_btn','value'=>'btn_save0','type'=>'submit','content'=>'Save');echo form_button($ubtn)?></span></div>
		<div class="profile_pic">
			<img src="<?php echo base_url()."assests/imgs/profile/thumbs/".$u_pr->prof_pic; ?>" width="200" height="200" alt="<?php echo $u_pr->un; ?>">
		</div>
		<div class="sec_content0">
			<blockquote>
				<span>gender:</span><span>
				<SELECT name="ugender">
<?php
@$u_gender=$this->input->post('ugender', TRUE);
foreach ($ar_gender as $val_gender) {

	if ($u_gender != NULL && !empty($u_gender)) {
		echo "<option value='$val_gender'"; if ($val_gender == $u_gender) {echo " selected='selected'";}
		echo ">".$val_gender."</option>\n";

	} else {
		echo "<option value='$val_gender'"; if ($val_gender == $u_pr->gender) {echo " selected='selected'";}
		echo ">".$val_gender."</option>\n";
	}//END if else post	
}
?>				</SELECT>				
				<span>name:</span>
				<span>
				<input type="text" name="ufname" value="<?php echo isset($_POST['ufname']) ? $_POST['ufname'] : $u_pr->ufn; ?>" maxlength="12">
				<input type="text" name="ulname" value="<?php echo isset($_POST['ulname']) ? $_POST['ulname'] : $u_pr->uln; ?>" maxlength="12">
			             </span>
				<span>username:</span>
				<span><input type="text" name="uname" value="<?php echo isset($_POST['uname']) ? $_POST['uname'] : $u_pr->un; ?>" maxlength="18"></span>
				<span>country:</span><span>
				<SELECT name="ucountry">
<?php
@$u_count=$this->input->post('ucountry');

foreach ($country as $value) {

	if ($u_count != NULL && !empty($u_count)) {
		echo "<option value='$value'"; if ($value == $u_count) {echo " selected='selected'";}
		echo ">".$value."</option>\n";
	} else {
		echo "<option value='$value'"; if ($value == $u_pr->u_country) {echo " selected='selected'";}
		echo ">".$value."</option>\n";
	}//END if else post	
}
?>
</SELECT>
				</span>	
				<span>phone: +</span><span><input type="text" name="uphone" value="<?php echo isset($_POST['uphone']) ? $_POST['uphone'] : $u_pr->u_phone; ?>" maxlength="18"></span>
		    </blockquote>
		</div>
	</li>
<?php endforeach; ?>
</ul><!-- END section Overview-->
<?php
echo form_close();
}else{
	....
}
Link to comment
https://forums.phpfreaks.com/topic/278544-codeigniter-foreach-loops-duplicates/
Share on other sites

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.