And below is how I assign the values driven from database to a drop down lis box which gets populated :$qry = "select \"EmployeeID\" AS empid, \"FirstName\"::text || ' ' ||\ +"LastName\"::text as name from \"Employees\""; $qq = $db_handle->prepare($qry); $qq->execute; while (@row = $qq->fetchrow) { $tt .= "<option value=$row[0]>$row[1]</option>\n"; }
Now back to the input text boxes how do I populate them, how do I assign values to them : Here is the query that fetches data for the input text boxes but I don't know how to assign values driven from the query to the text boxes :<form method=POST> Select an employee to be updated and press FETCH:<select name=empid>$t +t</select><br> ..............
Here is the form data I want to fill in with above values driven from the database :# If the form has been completed, save data entered if ($input{"go"} eq "FETCH") { $query = "SELECT \"LastName\" AS ln, \"FirstName\" AS fn, \"Title\" AS tl, \"TitleOfCourtesy\" AS tc, \"BirthDate\" AS bd, \"HireDate\" AS hd, \"Address\" As ad, \"City\" AS ct, \"Region\" AS rg, \"PostalCode\" AS pc, \"Country\" AS cy, \"HomePhone\" AS hp, \"Extension\" AS xt, \"Notes\" AS nt, \"ReportsTo\" AS rt FROM \"Employees\" WHERE \"EmployeeID\"="." \'$input{empid}\'"; $ins = $db_handle->prepare($query); $ins->execute; while (@row = $ins->fetchrow) { $ln .= "<input value=$row[0]></input>\n"; $fn .= "<input value=$row[1]></input>\n"; $tl .= "<input value=$row[2]></input>\n"; $tc .= "<input value=$row[3]></input>\n"; $bd .= "<input value=$row[4]></input>\n"; $hd .= "<input value=$row[5]></input>\n"; $ad .= "<input value=$row[6]></input>\n"; $ct .= "<input value=$row[7]></input>\n"; $rg .= "<input value=$row[8]></input>\n"; $pc .= "<input value=$row[9]></input>\n"; $cy .= "<input value=$row[10]></input>\n"; $hp .= "<input value=$row[11]></input>\n"; $xt .= "<input value=$row[12]></input>\n"; $nt .= "<input value=$row[13]></input>\n"; $rt .= "<input value=$row[14]></input>\n"; }
Many thanks in advance for your kind help !! Please note that I will post it on perlguru as well. Rgds Terry<div class="container"> <form method=POST> Select an employee to be updated and press FETCH:<select name=empid>$t +t</select><br> <input type=submit name=go value=FETCH> Last Name :<input name=lastname><br> First Name :<input name=firstname><br> Title :<input name=title><br> Title Of Courtesy :<input name=toc><br> Birth Date :<input name=dob><br> Hire Date :<input name=doh><br> Address :<input name=address><br> City :<input name=city><br> Region :<input name=region><br> Postal Code :<input name=pcode><br> Country :<input name=country><br> Home Phone :<input name=homephone><br> Extension :<input name=ext><br> Notes :<input name=notes><br> Reports To :<select name=repto>$hh</select><br> <input type=submit name=go value=UPDATE> </div> </form><hr>
In reply to How to get input text boxes populated by terrykhatri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |