<p>NOTE: I am not set on using VI, it is just the first thing that came to mind that might be able to do what I need. Feel free to suggest any other program.</p>

<p>I have a form with nearly 100 fields that I would like to auto-fill with PHP. I know how to do the autofill, but I would like to avoid manually adding the needed text to 100 fields.</p>

<p>Is there an automated way I can take the text:</p>

<pre><code>&lt;input name="riskRating" id="riskRating" type="text" /&gt;
</code></pre>

<p>and change it to:</p>

<pre><code>&lt;input name="riskRating" id="riskRating" type="text" value="&lt;?php echo $data['riskRating']; ?&gt;" /&gt;
</code></pre>

<p>Remember that I am wanting to do this to almost 100 fields. I am trying to avoid going to each field, pasting in the PHP code and changing the variable name manually.</p>

<p>I'm hoping some VI guru out there knows off the top of his/her head.</p>

```
:%s:\(<input name="\([^"]\+\)" id="[^"]\+" type="text" \)/>:\1value="<?php echo $data ['\2']; ?>" />:gci
```
That's one line.
HTH.