Hi i am new to php, can any of u help me,
I am storing details such as name , address, email id, phone no, fax no and all. and i am creating edit form to edit those details , i am returns almost all values except address and select location value, can any one tell me how to get those values,
Below is my code

$qry = "select * from tbl_customer where comp_id='$id'";
				$rst = mysql_query($qry,$con);
				if($rst){
					$row = mysql_fetch_array($rst);
					$customername = $row['comp_name'];
					$customeradd  = $row['comp_add'];
					$customerpnum  = $row['comp_pnum'];
					$customeremail = $row['comp_email'];
					$customerfnum  = $row['comp_fnum'];
					$customerloc  = $row['select_loc'];	

<td width="80">Username&nbsp;*&nbsp;</td><td><input type="text" name="comp_name" class="textbox"  size="30" maxlength="50" title="Enter your name" value="<?php echo $customername; ?>"/></td>  
 
 <td width="80">Address&nbsp;*&nbsp;</td><td><TEXTAREA ROWS="6" COLS="23" name="comp_add"  title="Enter Your Address" value="<?php echo $customeradd; ?>"></textarea></td>  

 <td width="80">Phone No&nbsp;*&nbsp;</td><td><input type="text" name="comp_pnum" class="textbox"  size="30" maxlength="20" title="Enter Valid Phone No" value="<?php echo $customerpnum ; ?>" /></td>  
 <tr>  
 <td>Location&nbsp;*&nbsp;</td>  
 <td><?php
/*$link = mysql_connect('localhost', 'root', ''); 
if (!$link) {
  die('Could not connect: ' . mysql_error());
}
mysql_select_db("b2bassociates");*/
include 'dbcon.php';

$qry = "select * from tbl_location order by loc_name";
$result = mysql_query($qry,$con);

?>
<select name="sel_loc" title="Select Location"  value="<?php echo $customerloc; ?>" >
<option value="">----Select Location----</option>
<?php 
while($row=mysql_fetch_array($result))
{ 
?>
   <option value="<?php echo $row['loc_code']; ?>" 
   >
   <?php echo $row['loc_name']; ?>
   </option>
<?php 
} 
?>
</select>
 </td>  
 </tr>

HERE I RETURN ALL THE DETAILS FROM DATABASE EXCEPT THE ADDRESS AND SELECT LOCATION, CAN ANY ONE TELL ME , hOW IT IS SOLVED

Hi..
i didnt get u...whats the problem here...have u got any error?
plz note it...

No ahmksssv,
no error throws, say i have some details in name column, address column, email column , fax no column, phone no column and i stored the code no of locations, suppose i want to edit any data regarding to name column i use value="<?php echo $customername; ?>"
here
<td width="80">Username&nbsp;*&nbsp;</td><td><input type="text" name="comp_name" class="textbox" size="30" maxlength="50" title="Enter your name" value="<?php echo $customername; ?>"/></td>

and the same for all the phone no, email fax no. and what i s problem i have is , i got all the results except the address column and select location. and i need ur help in how the get the post value of address and location where i stored in database

No ahmksssv,
no error throws, say i have some details in name column, address column, email column , fax no column, phone no column and i stored the code no of locations, suppose i want to edit any data regarding to name column i use value="<?php echo $customername; ?>"
here
<td width="80">Username&nbsp;*&nbsp;</td><td><input type="text" name="comp_name" class="textbox" size="30" maxlength="50" title="Enter your name" value="<?php echo $customername; ?>"/></td>

and the same for all the phone no, email fax no. and what i s problem i have is , i got all the results except the address column and select location. and i need ur help in how the get the post value of address and location where i stored in database

Hi.. the above code is correct.....
i think the address field is empty ,due to some reasons....

when u inserting address into database you use this way...

$address=mysql_real_escape_string($_POST['address']);

just try this one....

Hi ahmksssv,
My database's address field is not empty . though why <select> didnt echos their post value why ? i use <td>Location&nbsp;*&nbsp;</td>
<td><?php
/*$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("b2bassociates");*/
include 'dbcon.php';

$qry = "select * from tbl_location order by loc_name";
$result = mysql_query($qry,$con);

?>
<select name="sel_loc" title="Select Location" >
<option value="">----Select Location----</option>
<?php
while($row=mysql_fetch_array($result))
{
?>
<option value="<?php echo $row; ?>"
>
<?php echo $row; ?>
</option>
<?php
}
?>
</select>
</td>

I s this the correct way to echo the value
<?php echo $row; ?>

prawin@123,

Try the following,
Address text area should be :
<TEXTAREA ROWS="6" COLS="23" name="comp_add" title="Enter Your Address"><?php echo $customeradd; ?></textarea>


Select Box Should Be:
<select name="sel_loc" title="Select Location">
<option value="">----Select Location----</option>
<?php
while($row=mysql_fetch_array($result))
{
?>
<option value="<?php echo $row; ?>" <?php if($customerloc == $row)echo 'selected';?>>
<?php echo $row; ?>
</option>
<?php
}
?>
</select>

Hi Thanks , U solved My problem, Thank u very much for the solution , Keep doing this job

This question has already been answered. Start a new discussion instead.