Im pulling out table information from a mysql db:
I need the buttons to select the information shown into a textfield, the below code works perfectly for the mobile_number but does not work for serial_number. both field types are varchars.
php to pull out info and html button
<?php while ($row = mysql_fetch_array($query)) { ?>
<td><?php echo $row['serial_number']; ?><input type="button" value="select" onclick="button(<?php echo $row['serial_number']; ?>)" /></td>
<td><?php echo $row['mobile_number']; ?><input type="button" value="select" onclick="button1(<?php echo $row['mobile_number']; ?>)" /></td>
text fields
<input type="text" id="textfield"/>
<input type="text" id="textfield2"/>
JS for the buttons
function button(text) {
$("#textfield").val(text);
}
function button1(number) {
$("#textfield2").val(number);
}
Thank you for your help in advance.