asherinho Posted July 30, 2008 Share Posted July 30, 2008 hi guys! I have a form which has two fields,a select list field and a text field.The select field has a list of file numbers from the database and the text field takes the related file name.I want when user select a file number the corresponding file name should appear on the text field.in the database the file number and name are the fields of the same table.can php solve this? Link to comment https://forums.phpfreaks.com/topic/117299-can-php-do-this/ Share on other sites More sharing options...
TempleDMDKrazd Posted July 30, 2008 Share Posted July 30, 2008 hi guys! I have a form which has two fields,a select list field and a text field.The select field has a list of file numbers from the database and the text field takes the related file name.I want when user select a file number the corresponding file name should appear on the text field.in the database the file number and name are the fields of the same table.can php solve this? after the user selects something in the select input device put onChange="<?php code here ?>" Link to comment https://forums.phpfreaks.com/topic/117299-can-php-do-this/#findComment-603384 Share on other sites More sharing options...
asherinho Posted July 30, 2008 Author Share Posted July 30, 2008 I didn't get u exactly templeDMDKrazd.can u take a look at my code so that I can have a clear idia <HTML> <HEAD><TITLE>confirm form</TITLE></HEAD> <BODY> <? require("connection.php"); $db=mysql_connect("$host","$user","$password"); mysql_select_db("$dbname",$db); $result1=mysql_query("SELECT DISTINCT file_no FROM file_info"); $result2=mysql_query("SELECT DISTINCT file_name FROM file_info"); $result3=mysql_query("SELECT DISTINCT actn_officer FROM file_info"); $result4=mysql_query("SELECT DISTINCT prev_officer FROM file_info"); $result5=mysql_query("SELECT DISTINCT department FROM file_info"); if(!$db){ echo "<B style='font-size:16px;color:red;font-weight:bold'>Sorry the form can not be desplayed.No connection to the database,please contact the sysetm administrator</B>"; exit; } elseif(!result1 || !result2 || !result3 || !result4){ echo "<B style='font-size:16px;color:red;font-weight:bold'>There is system error,please click the link to reload the form </B>"; exit; } ?> <TABLE width="80%" border="0" cellpadding="0" cellspacing="0" border="1"> <TR><TD align="right" class="form">FILE NUMBER </TD> <TD align="left" class="form"> <? echo "<SELECT name='fno'>"; while($record1=mysql_fetch_assoc($result1)){ echo "<OPTION>".$record1["file_no"]."</OPTION>"; } echo "</SELECT>"; ?> </TD> </TR> <TR><TD align="right" class="form">FILE NAME </TD> <TD align="left" class="form"> <input typ="text" name="filename" size=30> </TD> </TR> </TABLE> </BODY> </HTML> Link to comment https://forums.phpfreaks.com/topic/117299-can-php-do-this/#findComment-603408 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.