Tag Archives: select

populate dropdown on selection of other dropdown

Questions: I have two drop-down boxes. I want to populate second drop-down box on selection in the first drop-down box. My values are retrieving from database. Is this possible without using php or I need intermediate ajax and php file to get values from first drop-down and populate values file. Or this is possible without… Read More »

Dynamic chained select box

Questions: Okay, so I have 2 select boxes on my page, the first with the name “select” with the following options hard-coded: <select name=”select” id=”Testid”> <option value=”Misc”>Misc…</option> <option value=”Stunt”>Stunt</option> <option value=”deathmatches”>Deathmatches</option> <option value=”Car”> Car </option> <option value=”Races”>Races </option> </select> The second select box however (named “deleteTp”) I want to populate with a mysql table depending… Read More »

PHP show drop down selected based on value [closed]

Questions: I want to show a drop down selected for some value which is coming from database. <select name=”plans”> <option>MAP</option> <option>CP</option> <option>CPA</option> <option>CPF</option> </select> Reading a value from database in PHP/Mysql, lets say “CPA”, how do I show this option selected? Answers:


Questions: I have a strange behaviour using PHP PDO for a INSERT from a SELECT query. Testing the query directly in MySQL it works well, I get my row inserted : INSERT INTO sessionid (enc_id, enc_pass, enc_date) SELECT AES_ENCRYPT(username, ‘aeskey’), AES_ENCRYPT(pwd, ‘aeskey’), DATE_ADD(NOW(), INTERVAL 15 SECOND) FROM users WHERE username = ‘a_user_name’; But using PDO,… Read More »

Selecting default value in html dropdown list

Questions: I am currently looking to have a drop down list in my form. I have this drop down which selects the default value: <p>Price Band:<select id=’priceBand’ style = ‘width:150px’ value = ‘band1’> <option value=”band7″>Reduce by 30c</option> <option value=”band6″>Reduce by 25c</option> <option value=”band5″>Reduce by 20c</option> <option value=”band4″>Reduce by 15c</option> <option value=”band3″>Reduce by 10c</option> <option value=”band2″>Reduce… Read More »

Set default value for HTML select control in PHP

Questions: I’ve got an html select drop down for 50 states, and i’ve got a default state value in PHP. Is there an easier way to set the default select value than doing <option value=”NY” <?php if ($default_state == ‘NY’) echo ‘selected=”selected”‘; ?>New York</option> 50 times? In other words, do I have to run a… Read More »

Jquery autocomplete and PHP: populating input field with data from mySQL database based on selected option in autocomplete field

Questions: I am trying to populate a Postcode (ie zipcode) input field with data from a mySQL database, based on the user’s selected option of Suburbs from a jQuery autocomplete field. The autocomplete works fine – the filtered Suburbs list is retrieved based on the input terms from the user. The source reference is a… Read More »