Bulk update textfield values


I have a huge form of more than 130 fields (textfields, textareas, checkboxes etc), I have this form in HTML format, I mean its a simple .html page. What I want is, for each field I want to set its value to value=“<?=$row[‘textfieldname’];?>”

Let’s take the following textfield as an example:

<input type="text" name="gender" id="gender" />

I want to change it to"

<input type="text name="gender" id="gender" value="<?=$row['gender'];?>" />

I would really appreciate if you can advice an easy way to achieve this.

PS: I’ve heard it can be done using Dreamweaver’s regular expressions, anybody have this idea?

Many Thanks in advancee

I think what you mean is something like -

$query = 'select gender from myTable';
//now run the query
$rs = mysql_query($query, $conn);
//now output the input elements
$count = 1;
while($row=mysql_fetch_assoc($rs)) {
       echo '<input type="text" name="gen_'.$count.'" id="gen_'.$count.'" value="'.$row['gender'].'" />';
$count = $count + 1;

Hi Kalon,

Thanks for the nice idea. The problem is, all the fields are grouped and its not possible to run a loop through the fields, what I need is a regular expression kinda solution that will run through the HTML and make the necessary changes to each field. Thanks