Tim Streater <
timst...@greenbee.net> writes:
> In article <kpmts0$5ai$
1...@news.albasani.net>,
> Jan Novak <
bfo...@yahoo.de> wrote:
>>
>> a have a (php/html) Form with multiple Buttons und multiple input fields.
>> The Buttons and Fields are generated like this
>>
>> (php code)
>> echo '<input name="USERNAME_'.$id.'" class="Feld" value="'
>> .$record['USERNAME']. '" autocomplete="off" >';
>>
>>
>> Now i want, that if i click on a button, that one of the fields is
>> filled up with some data.
>>
>> (php code)
>> echo '<input type="button" name="zeige" class="Button" value="Show"
>> onclick="this.form.USERNAME_'.$id.'.value=\''.$record['USERNAME'].'\'">
>> ';
>> This function is only working, if the Textfiled is named without the
>> "id" extension (like 'Username" and not 'Username_'.$id)
>>
>> Anybody know a solution for this ?
>
> You can't do that with PHP; it's not running in the user's browser.
The OP is trying to do it with some client-side scripting generated by
PHP.
To the OP: Posting PHP adds a level of uncertainty about what's actually
going on. What do the two input element look like in the generated
document?
A simple test with these two code fragments used in isolation works for
me, so the problem is somewhere else -- very likely in some other part
of the PHP as has already been suggested.
--
Ben.