i have a form which has a select box and some text boxes
so if i select certain option from select box,
i wanted to fill up the text boxes with the information related to selected option from database.
i don't know how much simple/difficult it was,
but now i have solution to it
posting here just bcuz i feel, it could help someone like me
code
<?php
$regid=$_GET["reg_id"];
$handle1=mysql_query("select fname,lname,dob,age,sex from Registration where registerID='$regid'");
while($row1=mysql_fetch_array($handle1))
{
$temp_fname=$row1["fname"];
$temp_lname=$row1["lname"];
$temp_dob=$row1["dob"];
$temp_age=$row1["age"];
$temp_sex=$row1["sex"];
}
$temp_out = '<script language="javascript">
function dispfun() {
box = document.getElementById("edit-reg_id");
id = box.options[box.selectedIndex].text;
if (id)
{
location.href = ("get", "/somepath?reg_id="+id);
}
}</script>';
$handle=mysql_query("select registerID from Registration");
while($row=mysql_fetch_array($handle))
{
$opt[0]="Choose";
$opt[] .=$row["registerID"];
}
$temp_out .= select('reg_id','',$opt, 'onchange=dispfun()');
//make necessary changes in form select box
//it's just input type select with options in $opt array and path to onchange to js function
//$temp_out .= form text boxes to be filled up with the value filled in as $temp_fname;
//as calculated above n so on
echo $temp_out;
?>
i don't know how much this will help u,
in case u have any doubts regarding this
i am here
hope it helps someone needful
cheers!!
GaYaTrI
This post has been edited by hotsnoj: 09 March 2006 - 12:02 PM

New Topic/Question
Reply



MultiQuote



|