• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Javascript: Concatenate passed variable to name of form element?


Active Member

Say I have a form with elements 'textbox1' thru to 'textbox10'. I am trying to use a javascript function to pass the returned row ID from an SQL database for example:

<input type="text" name="textbox1" value="" onclick="javascript:functionname(<?= $sql_rowid ?>)" />

I want to be able to concatenate the passed row ID to a form element name. This is incorrect of course, but it may give an insight into what I am attempting to do:

document.form_name.textbox + passedSQLRowID.value

Therefore, I am able to access the value of 'textbox1'...

Any ideas? I have been unable to find a way to do this using Google and W3Schools.com as my best friends :p

Thanks in advance,