0

:-/
my html form consists of drop down for selecting city and state.
radio buttons for selecting gender.
and a few check boxes.

the form is filled and the values are stored in a database table.

I am working on a php script, which retrieves values from database into an array.

consider that my array's first element corresponds to a radio button with value M ( M- male)

then i want the radio button for male to be selected.

similarly if a particular city is selected the i want that city selected in the drop down menu...

this is similar to web sites to which we are registered allow us to update our profiles by displaying the fields with the old values....

your response will be of great help to me...
thanking you guys in advance!!
:)


.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by adamworld
0

post your code...thats easier to understand.

0

Create a recordset pulling the data from the database. Then, "hook up" the drop down or whatever to the data. Here is an example for a dropdown in php:

<select name="state" id="state">
                      <option value="">-- Select A State --</option>
                      <?php
do {  
?>
                      <option value="<?php echo $row_states['state_name']?>"><?php echo $row_states['state_name']?></option>
                      <?php
} while ($row_states = mysql_fetch_assoc($states));
  $rows = mysql_num_rows($states);
  if($rows > 0) {
      mysql_data_seek($states, 0);
	  $row_states = mysql_fetch_assoc($states);
  }
?>
                    </select>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.