wordpress - How to add a 'selected' in a select dropdown wp/php -
I have a problem that I'm not sure how to contact, I have a WP plugin that contains the form, I have a The result is that there may be a diverse quantity of data (depending on the user being presented).
How can I add 'Selected' to the selected item, when the user returns, who can edit / view who has chosen that item?
& lt; Select Name = "Supplier" & gt; & Lt; Option value = "Supplier 1" & gt; Supplier 1 & lt; / Options & gt; & Lt; Option value = "Supplier 2" & gt; Supplier 2 & lt; / Options & gt; & Lt; Option value = "Supplier 3" & gt; Supplier 3 & lt; / Options & gt; & Lt; Option value = "Supplier 4" & gt; Supplier 4 & lt; / Options & gt; & Lt; / Select & gt; A loop comes in the brain, will I specify the number for each option? Can be 100 suppliers, so will it require accurate counting?
I will use a loop. $ theirChosenSupplier = $ supplierVarFromDatabaseOrWherever; ? & Gt; & Lt; Select Name = "Supplier" & gt; Foreign currency ($ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ } And {$ selected = ""; }? & Gt; & Lt; Option value = "& lt ;? php echo $ individualSupplier ;;> & Lt ;? Php echo $ selected; ? & Gt; & Gt; & Lt ;? Php echo $ individualSupplier; ? & Gt; & Lt; / Options & gt; & Lt ;? Php}? & Gt; & Lt; / Select & gt; This code has not been tested but you should give an idea. If I am misunderstood this question then apology
Comments
Post a Comment