Jump to content

mysql with drop down menu


czukoman20

Recommended Posts

I have this drop down menu, and i want it to be able to look at what the user has in the database, and then i would like it to show up in the drop down as the default when the user goes into edit account

 

<tr><td>Type of Market:</td>
  <td><label>
    <select name="type_market" id="type_market">
      <option value="sto">Stocks </option>
      <option value="com">Commodities</option>
      <option value="edu">Education</option>
      <option value="fin">Financial Planning</option>
      <option value="mort">Mortgages</option>
              </select>

I want to make this take this value

<? echo $req_user_info['type_market']; ?>

kinda like how you would insert the text that they already have in the text box, but instead for a drop down menu

 

also just a side question.. What mysql query can i use to update a whole column in the database to = 0

 

help is appreciated thanks

Link to comment
https://forums.phpfreaks.com/topic/110807-mysql-with-drop-down-menu/
Share on other sites

Have a check for the value in the row for each item in the select:

 

<option value="sto" <?php echo $req_user_info['type_market'] == "sto" ? 'selected="selected" : ''; ?>>Stocks </option>

[quote]What mysql query can i use to update a whole column in the database to = 0[/quote]

Don't use a WHERE clause...

[code]UPDATE table_name SET column = 0;

[/code]

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.