Array count values - php

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.

Related

How to post the value in text box the were generate using looping from database

I have a table that were listed using looping from mysql database. In column edit i had a textbox and edit button. I want to post the value of the text box when user click edit button.My problem is when i click the edit button the value in the post take the value of last one(which group name = QW).
when i click the edit button the value in the post take the value of last one(which group name = QW).
So give them unique names.
Probably ones which incorporate the row number in the database.
e.g.
name="foo[row_number]"
… which will then let you loop over $_POST['foo'] as an associative array.

generating the second drop down list depending on the first list value

I need two drop down list in the same page.The values in the first list are to be fetched from one table and depending on that selected value another set of values should be fetched from another table and show it in the second list.After that both the selected values are to be inserted in a third table on a button click.
Please help me out.
You should add onchange event for the first element and in the onchange handler call an ajax call. In the success handler populate the second dropdown element.

getting value from list of combo box

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.

Get Row value from custom gridview when checkbox is checked

I am developing apps in Codeigniter, i am stuck in some code...i just want to know how can i get complete row values if any one check the checkbox and submit, so i should get row value of selected checkbox....
You can use array for while creating rows, use name for your each row's input field as array and when you submit the your form loop over your checkbox array and get the values from other elements using the same key which selected checkbox is having

Jquery get previous value in jquery

I get the script for selecting the previous selected value in list box from Jquery get the pervious selected value in listbox
It is fine for the individual select boxes.
I have multiple select boxes. I wrote the change event with the class name. It returns undefined. Please refer this fiddle
http://jsfiddle.net/uW2ND/1/
How can i get the previous selected value of the each selected list box with this.
You forgot to include the code that actually sets the value of the jQuery-data to the previous value!
Check out this solution: http://jsfiddle.net/uW2ND/2/
This fiddle illustrates the proper way to persist the previous value. More specifically, it stores each select box's previous value in its related data() container. The first time around it would not alert anything, since no previous value is set.
http://jsfiddle.net/KxEKd/1/

Categories