I have a list of combox box that I generate on runtime on the basis of number of rows.If there are 5 rows there are 5 combo boxes.
I have a submit button on the bottom and I want that when I click on submit It should sae the updated value in database.In php we get value from a combo box <select name="cc"></select>
with $_POST['cc'],But now I have each combo box, so my problem is
Giving different name to each combo box (might use an array
Getting value from the set of combo boxes.
Any one who can help me with this
You can use cc[] as the name and in PHP your going to receive an array with all the info.
Or maybe you can just append a number after each name and interate them to read all results.
<select name="cc[]">...options...</select>
<select name="cc[]">...options...</select>
<select name="cc[]">...options...</select>
then in PHP $_POST['cc'] should be an array with all the selected options.
Related
Programming in Bootstrap and PHP I am trying to create a dynamic form which has the following.
User uses a dropdown to select number from 1 to 10.
The page then displays x number of dropdowns.
Each dropdown is the same and displays a list of userID from a MySQL table tblUsers
Once the user makes a selection from each dropdown, it then shows a second dropdown immediately underneath showing a list of videos from a second MySQL table tblVideos. Meaning that the second dropdown is based on the results from the first.
Once all dropdowns have been selected. Submit is pressed and the results are sent as an array to the table tblVideoStored
Any ideas how the PHP and MySQL would be in a simple form..
Based on what you plan to achieve, you may want to look into combining php with ajax (Javascipt). Below are some examples that should set you on the right path
https://www.sitepoint.com/community/t/using-ajax-to-populate-dropdown-menu/4350/2
http://blog.chapagain.com.np/using-jquery-ajax-populate-selection-list/
i want to fetch the value corresponding to textbox value and the results from database show to the select box.
For eg: in a textbox i have entered "abc" now i want whatever database having abc related information come to select box.
You are looking for autcomplete functionality. You can use select2 or something similar.
I have added 5 drop down fields in my form with the same name. These field will be displayed based on selected country's radio button.I have 5 radio buttons named as "USA,INDIA,UK,EURO,AUS".
If i select USA, 1st drop down contains US sizes, will be displayed.
If i select INDIA,2nd drop down contains INDIAN sizes, will be displayed.
All are working Good. Now i have an issue with store that value to my DB in magento. When i submit the form, 5th drop down field(EURO sizes) value only saved.
If i select size other than EURO,I got an empty value. If i select Euro size, I got correct value.I hope you understand my problem. Please guide me to solve mine issue guys!
You can add disabled attribute to other drop-downs when you show the selected one. This way the browser will ignore the disabled ones.
Or, you could append [] to your drop-downs' name, like this:
<select name="name[]"> ... </select>
This way you will get an array in the request variable, then you can decide which to use in the array according to your radio button value.
i have two select box i can add my choice from first box to 2nd box 2nd remove 2nd box to 1st box.
i can add all option from 1st box but not remove all from 2nd(at least one option there).
now how can i send this data in database. please give me solution.
I am new to php, i have some problem in php page. This page contain one while loop, in that loop itself taking record from data base, it showing taxt box, list box like this,,,etc..Here php page while loop contain more then 5 records. here i need to select list box value to pass post to set session in next page. From that session i have take value to show next php page.
So here which type array i have to use,...and using get am going to pass value ,,,but value is 0 coming without selecting value,,..if am select list box value it ll come null value,,please suggest how can i pass whole value to next page,...
thanks
periyasamy
Insert the contents of the data from the previous page into the form that posts to the next page, in the form of <input type="hidden" name="foo" value="bar" />. Then, pull it out of the $_POST array on the next page.
About the <select> element returning NULLs, try specifying the name attribute on the <select> element, and a value attribute on each of the <option> elements. Don't forget to have one with the selected="selected" attribute set, to specify a default.