how to create drop down selection box with manual entry ?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

nanao550
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Dec 17, 2002 2:37 pm

how to create drop down selection box with manual entry ?

Postby nanao550 » Tue Dec 17, 2002 2:47 pm

Hello,
I have a drop down selection box with the options populated by a mysql query. Is it possible to allow a manual entry of an string for an option that is not currently in the drop down box?

If so, how can this be done?

Thanks.

serg_dz
New php-forum User
New php-forum User
Posts: 13
Joined: Thu Oct 10, 2002 10:37 pm
Location: Ukraine

Postby serg_dz » Tue Dec 17, 2002 11:31 pm

I don't remember the standard capabilities of HTML. I can advice you to use input type=text, button, select paced on another layer(div) and to show/hide that layer when ever you need.

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Wed Dec 18, 2002 2:48 am

you can do in the diferent way.

select drop down menu &java script

you are select new menu and there are creates input box =)

nanao550
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Dec 17, 2002 2:37 pm

Can you provide sample, please?

Postby nanao550 » Thu Dec 19, 2002 8:34 am

Would it be possible for you to provide an example using javascript as you mention. I would like to see exactly what it would works like and how the code and structure would be like, and if it would be possible to apply this to php. I would like to avoid using javascript, because it can be disable by the browser.

Thanks

uncertain_manos
New php-forum User
New php-forum User
Posts: 31
Joined: Wed Oct 23, 2002 12:55 am

Re: Can you provide sample, please?

Postby uncertain_manos » Thu Dec 19, 2002 10:22 pm

nanao550 wrote:Would it be possible for you to provide an example using javascript as you mention. I would like to see exactly what it would works like and how the code and structure would be like, and if it would be possible to apply this to php. I would like to avoid using javascript, because it can be disable by the browser.

Thanks


Hi there,
here is a piece of code for the php part. I assume here that we have 3 option values and I have put a textbox to get the value for the input. The code in PHP goes like:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="put.php">
  <input name="c1" type="text" id="c1">
  <p><select name="select">
    <option>1</option>
    <option>2</option>
    <option>3</option>
<?php echo("<option>".$c1."</option>") ?>
  </select>
  <input type="submit" name="Submit" value="Submit">
</p></form>
</body>
</html>


Every time the user inputs a value in the textbox and then presses the button he gets a reload and update event.
Hope it helps,
Manos


Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], krotbacca and 2 guests