PHP only displaying ID and not the value from mysql -


I have a selection menu with values ​​below 'apartment_type' in a mysql database when I & lt ;; Php echo $ _POST ['apartment_type']; ? & Gt; This only shows ID numbers How can I echo the type of apartment instead?

Enter image details here

This is the initial form:

  & lt; Div class = "form-group" & gt; & Lt; Select class = "form-control" id = "apartment_type" name = "apartment_type" & gt; & Lt ;? Php echo $ bsiCore- & gt; GetApmtTypeCombobox () ;? & Gt; & Lt; / Select & gt; & Lt; / Div & gt;   

thanks

As told, not $ _POST Instead of including values ​​derived from the database, rather, this data that is posted on the script (from your form)

I think & lt ;? Php echo $ bsicore-> GetApmtTypeCombobox () ;? & Gt; Too many & lt; Option value = "id" & gt; Apartment type 1 & lt; / Option & gt; s

is going to generate> a & lt; Select & gt; Input, like you've found, selected & lt; Options & gt; For example, IDs will be posted to the value attribute of .

Normally, you will edit the ID again and later to get that advertisment type display value, and whatever you are looking for will be better. If you were building a multi-language site, you might need to join a separate table to get the display value based on the language given in question, so it does not mean to cache string value Will happen.

If you really want to get the string value of the type of apartment type to be posted on your form handling code, you can & lt ;? Php echo $ bsicore-> GetApmtTypeCombobox () will need to adjust the output) ;; & Gt; To use the value of the option that you want to post in the value attributes of the option (like & lt; option value = "apartment type 1" & gt; apartment type 1 & lt; / option & Gt; )

PS: There is only one "P" in the apartment :)

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -