Jump to content

drop down option selected into text field


adzie

Recommended Posts

Is it possible once I have selected an option from a drop down box which displays information from a DB to display that chosen option in a text box?

 

my code so far below:

 

<?php

 

//Connect to db

 

$_POST['name'].

 

include("connectdb.php");

 

$query = "SELECT name FROM pilots";

$result = mysql_query($query);

 

echo "<select name=\"names\">\n";

while($row = mysql_fetch_array($result))

echo "<option name=\"".$row['name']."\">".$row['name']."</option>\n";

 

 

 

 

?>

<table width="300" cellpadding="10" cellspacing="0" border="2">

<tr align="center" valign="top">

<td align="center" colspan="1" rowspan="1" bgcolor="#64b1ff">

<h3>Edit and Submit</h3>

<form action="change_form.php" method="post">

<input type="Submit" value="Update">

</form> Click Here to acces that members File

</td></tr></table>

thanks for your reply

 

i think i'm missing something from my second page, any thoughts as they selected name does not appear on the next page

 

<html><head><title></title></head>

<body>

<?

 

echo "<input type=\"text\" value=\"".$_POST['names']."\">";

 

?>

<table width="300" cellpadding="10" cellspacing="0" border="2">

<tr align="center" valign="top">

<td align="center" colspan="1" rowspan="1" bgcolor="#64b1ff">

<h3>Edit and Submit</h3>

<form action="change_record.php" method="post">

<input type="text" name="name" value="<?php print $_POST['name']?>">

<input type="hidden" name="password" value="<?php print $_POST['password']?>">

<input type="hidden" name="vid" value="<? echo "$vid" ?>">

Name:    <input type="text" name="name" value="<? echo "$name"?>"?><br>

Password:    <input type="text" name="password" value="<? echo "$password"?>"?><br>

<input type="Submit" value="Update">

</form>

</td></tr></table>

 

 

 

<?

 

 

?>

</body>

</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.