How can I add text into a certain area?
<p>If I have a line like this,</p>

<pre><code>&lt;option value="someval"&gt;somval&lt;/option&gt;
</code></pre>

<p>how can I position the cursor after the last quotation of value and put something like <code>abcdef</code>?</p>

<p>So the output would be</p>

<pre><code>&lt;option value="somval" abcdef&gt;somval&lt;/option&gt;
</code></pre>

<p>with <a href="http://en.wikipedia.org/wiki/PHP" rel="nofollow">PHP</a>?</p>

<p>I want to do this dynamically and I can't figure out how to do it. I'm looking at <code>strpos()</code>, but I don't see how it can be done. I'll be posting a bunch of option tags into a textbox and code will be generated. so I'll have a lot of option fields.</p>

<p>@martin - Say I have a huge dropdown and each option lists a country that exists. Rather than having to manually type out something like this:</p>

<pre><code>$query = $db-&gt;query("my query....");
while($row = $db-&gt;fetch($query)) {

&lt;select name="thename"&gt;
    &lt;option value="someval" &lt;?php if($row['someval'] == 'someval') { print "selected"; } ?&gt; &gt;someval&lt;/option&gt;
    &lt;option value="someval" &lt;?php if($row['someval'] == 'someval') { print "selected"; } ?&gt; &gt;someval&lt;/option&gt;
    &lt;option value="someval" &lt;?php if($row['someval'] == 'someval') { print "selected"; } ?&gt; &gt;someval&lt;/option&gt;
    ... Followed by 100 more, because there are a lot of locations to list.
&lt;/select&gt;
</code></pre>

<p>How can I post all the options I have into a textbox and have the above code automatically generated to save a lot of time?</p>
