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
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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.